What is the format to upload content to confluence by REST? - rest

I found some information about the REST interface of Confluence (https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/#content-update), but I have not understood yet which format is expected for the content of the page that should be created or updated.
Is it HTML? Or the Confluence Wiki markup? Or something else?
Note that I am not interested in Confluence Cloud, only on premise.

The rest/api/content/ accepts
{
"type": "page",
"title": "`some title",
"space": {
"key": "ICXMV"
},
"body": {
"wiki": {
"value": "h1. Hello world!",
"representation": "wiki"
}
}
}
So it is possible to upload content in the Confluence Wiki format.

Related

Can't modify user_defined context with Watson Assistant API v2

I'm trying to migrate chatbot to use newly introduced Assistant API v2.
My chatbot infrastructure includes Middleware services which modifies the context after getting the response from Watson. In some case I used to remove particular properties from the context and it worked fine. However I noticed that after migration to API v2 this approach does not work anymore as the deleted properties are somehow stored on Watson side.
For example I received following context from Watson:
{
"assistantId": "---",
"sessionId": "---",
"messageInput": {
"Text": "Some text",
"Options": {
"Debug": "true",
"ReturnContext": "true",
"Restart": "false"
}
},
"context":
{
"Global": "null",
"Skills": {
"AdditionalProperties": {
"main skill": {
"user_defined": {
"id": "23",
"description": "Dont know"
},
"system": {---}
}
}
}
}
}
Then I remove 'description' from the context and send request to Watson once more. Surprisingly 'description' is still there with the same value ('Dont know').
Possible solution would be not to remove a property but to set it's value to empty string. But even in this case my dialog does not work correctly as Watson somehow stores the point in dialog it was visiting previously (or not, these are my guesses). I assume it might be related to system.state property which stores an encoded state of the dialog (again - or not).
My question is why is dialog behaving this way?
How does it store the context information so I can't remove properties from user_defined context?
And how can I reset dialog state to initial keeping the same conversation_id (session_id)?
P.S. I'm using Watson API v2: 2020-04-01

REST API, POST Rich Text Item to Domino server

i am trying to use the REST-API of my domino lotus notes server (9.0.1FP8)
It works for simple text-fields but if I try to add an rich-text-item as json, the domino server receives only the text-fields and the richt-text field is empty.
I try it with Postman and a Postrequest to http://localhost/Test/JSON_Vie…s/name/List?form=mainForm,
where I send the json
{
"title":"test rich text",
"artist":"rich texter",
"ntracks":1,
"attachments": {
"type": "multipart",
"content": [
{
"contentType": "multipart/alternative; Boundary=\"0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1\"",
"contentDisposition": "inline"
},
{
"contentType": "text/plain; charset=US-ASCII",
"data": "test rich text",
"boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
},
{
"contentType": "text/html; charset=US-ASCII",
"contentDisposition": "inline",
"data": "<html><body><font size=\"2\" face=\"sans-serif\"><b>test rich text</b></font></body></html>",
"boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
}
]
}
}
The mask mainForm has the text-fields "title", "artist" , "ntracks" and the rich text-field "attachments".
How can I send an image as json and what is "boundary"?
Have you any idea , what's going wrong?
According to the documentation from IBM you need to use PUT (instead of POST) in order to update the fields.
After experimenting a little bit, I now know what was wrong. If I do the POST on the address http://localhost/Test/JSON_Views.nsf/api/data/documents?form=mainForm it works with the attachment. If I use http://localhost/Test/JSON_Views.nsf/api/data/collections/name/List?form=mainForm&computewithform=true the attachment field is ignored. But maybe you can explain me, what the extra field boundary is and if I can set the contentLocation by the name of my attachment?

Watson Assistant action to call IBM Cloud Function fails with Direct CloudFunctions calls are not supported on this platform

We are trying to implement cloud functions in Watson conversation but am receiving message 'Direct CloudFunctions calls are not supported on this platform'. When I googled for the error, I see that the issue could be because the region for WA and the cloud functions are different or not in US South/Germany. But I can confirm that both my WA and cloud functions are in US South.
I was trying in the 'Try out' panel. Below is the mock json editor content for my dialog node.
{
"context": {
"my_credentials": {
"user": "jgjg",
"password": "khk"
}
},
"output": {
"text": {
"values": [
"response text"
]
}
},
"actions": [
{
"name": "/<myIBMCloudOrganizationID>_<myIBMCloudSpace>/get-http-resource/weather",
"type": "server",
"parameters": {
"location": "Austin"
},
"credentials": "$my_credentials",
"result_variable": "$my_result"
}
]
}
Can you pls advise me on what am I doing wrong. Thanks.
I was going through the same issue. Cloud functions are only available in some regions. If your app is hosted in sydney or somewhere you cannot use that service there. Create a new app and set the location to london
Are you sure your user and password are set correctly?
Your user should consist of LETTERS and NUMBERS and some HYPHENS. like so : ...a-32d7-7d...
Your password should be just a string ...gafhWhu6alirEVpD...
Both are found in your api key on your IbmCloudFunctions page : https://console.bluemix.net/openwhisk/learn/api-key
Username is before the : of the api key and
Password after the : of the api key
If you already know this then i'm afraid i dont know how to help you.
Best

How to fetch comments with Facebook Graph API from comments plugin

I am trying to get all comments from my website.
I have found this method in plugin FAQ:
https://graph.facebook.com/v2.6/?fields=og_object{comments}
&id=<YOUR_URL>
&access_token=<YOUR_TOKEN>
But it neither corresponds to API reference (there's no field named comments in returned OpenGraph object), nor actually works. So I managed only to fetch amount of comments, but not actually their contents. Is it possible to do so?
The code referred to in the FAQ appears to be for v2.6 of the API, and so may be superceded.
I get comments from the Comments Plugin with the following.
First I get the Facebook Graph ID for the URL the Comments Plugin is operating within:
https://graph.facebook.com/v2.8/?id=<<YOUR_URL>>
&access_token=<<YOUR_TOKEN>>
This returns a response like this:
{
"og_object": {
"id": "<<OBJECT_ID>>",
"description": "<<OPENGRAPH_DESCRIPTION>>",
"title": "<<OPENGRAPH_TITLE>>",
"type": "article",
"updated_time": "2017-02-08T13:53:48+0000"
},
"share": {
"comment_count": 0,
"share_count": 0
},
"id": "<<YOUR_URL>>"
}
We then take that Open Graph Object ID and plug it into this:
https://graph.facebook.com/v2.8/<<OBJECT_ID>>/comments?summary=1
&filter=stream
&order=reverse_chronological
&access_token=<<YOUR_TOKEN>>
You'll get an object with a data property which will be an array of comments.
Testing for URL Provided by OP
https://graph.facebook.com/v2.8/
id=http://pdffiller.com/6962253&access_token=[REDACTED]
Returned
{
"og_object": {
"id": "1195506680497732",
"description": "Fill w9 fill out online 2014-2017 form irs instantly, download blank or editable online. Sign, fax and printable from PC, iPad, tablet or mobile. No software. Try Now!",
"title": "2014-2017 Form IRS W-9 Fill Online, Printable, Fillable, Blank - PDFfiller",
"type": "website",
"updated_time": "2017-02-08T12:08:37+0000"
},
"share": {
"comment_count": 0,
"share_count": 24
},
"id": "http://pdffiller.com/6962253"
}
Note the comment_count is zero, hence why no comments are returned by the Graph API

Can't post node that requires a pre assigned value with services api

I have setup a content type with a subject field that has pre assigned values in a dropdown field.
I am using the services api to post new content from a polymer app.
When I POST to the api I send the field structure and value in json but get and error.
"406 (Not Acceptable : An illegal choice has been detected. Please contact the site administrator.)"
Even though the object I am sending matches one of the required values in the field.
Do I need to prefix the value with something? I assume I'm posting to the right place to get that response but don't know why it would accept anything other than the string value.
Here is what I sent to the api which is picked up by my Charles proxy.
{
"node": {
"type": "case",
"title": "my case",
"language": "und",
"field_subject": {
"und": {
"0": {
"value": "subject1"
}
}
},
"body": {
"und": {
"0": {
"value": "my details of subject"
}
}
}
}
}
And here is an example of what I have setup in my Drupal field
subject1| first
subject2| second
subject3| third
subject4| forth
For anyone else with the same problem, this subject is poorly documented, but the answer is simple, my subject did not need the value key despite devel suggesting thats how it would be formatted.
"field_subject": {
"und": [
"subject1"
]
}
I could also shorten my code with "und" being an array.