I'm using the REST API to create Wiki pages like this:
{"title": "ldmin", "type": "page", "space": {"key": "dh"}, "ancestors": [{"id": 602832998}], "body": {"storage": {"representation": "storage", "value": "<ri:content-entity ri:
content-id=\"cleanupAt\"><h1>CleanupAt</h1> ......
Later on I like to retrieve this page by the API to edit some parts, therefore I like to identify the part using the ri:content-id. But the ID wasn't stored. On requesting the page I only get the <ri:content-entity> element but without the content-id attribute.
What I'm doing wrong?
Thx and best regards, Jörg
Hi @Jörg Wendel
Welcome to Confluence!!
If your are successful with creating pages for getting content ID
Try with this API and let me know if it works
curl -u admin:passwword -X GET "http://your-conf-site.com/rest/api/content?title=A1&spaceKey=MS"
A1 is the Page title
MS is the Space Key
Thanks,
Pramodh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the answer. Sorry I explained this a little badly.
I have no problem with creating a page with POST, nor with retrieving this or another with GET.
My problem is that I would like to give an id to the elements on the page to identify them later on. Am I going the wrong way with ri:content-id?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here a complete example, I create a page wit POST and this payload:
{
"body" : {
"storage" : {
"representation" : "storage",
"value" : "<ri:content-entity ri:content-id=\"teflosPath\"><h1>TeflosPath</h1></ri:content-entity><p style=\"font-size:smaller;\">Name: teflosPath<br/>Type: string<br/>Default: <br/>Mandatory: yes<br/></p>"
}
},
"ancestors" : [
{
"id" : 602832998
}
],
"type" : "page",
"title" : "teflosin",
"space" : {
"key" : "dh"
}
}
This works so far and the page appears in the wiki.
Now I request the page with GET and the response is:
{
"_links" : {
"base" : "https://wiki.id1.de",
"context" : "",
"self" : "https://wiki.id1.de/rest/api/content?spaceKey=dh&expand=body.view&type=page&title=teflosin"
},
"limit" : 25,
"size" : 1,
"start" : 0,
"results" : [
{
"_expandable" : {
"history" : "/rest/api/content/602833496/history",
"descendants" : "/rest/api/content/602833496/descendant",
"version" : "",
"ancestors" : "",
"children" : "/rest/api/content/602833496/child",
"container" : "/rest/api/space/dh",
"space" : "/rest/api/space/dh",
"operations" : "",
"metadata" : "",
"restrictions" : "/rest/api/content/602833496/restriction/byOperation"
},
"_links" : {
"self" : "https://wiki.id1.de/rest/api/content/602833496",
"tinyui" : "/x/WILuIw",
"webui" : "/display/dh/teflosin",
"edit" : "/pages/resumedraft.action?draftId=602833496"
},
"status" : "current",
"body" : {
"_expandable" : {
"editor" : "",
"anonymous_export_view" : "",
"storage" : "",
"styled_view" : "",
"export_view" : ""
},
"view" : {
"representation" : "storage",
"_expandable" : {
"content" : "/rest/api/content/602833496",
"webresource" : ""
},
"value" : "<ri:content-entity><h1 id=\"teflosin-TeflosPath\">TeflosPath</h1></ri:content-entity><p style=\"font-size: smaller;\">Name: teflosPath<br/>Type: string<br/>Default: <br/>Mandatory: yes<br/></p>"
}
},
"extensions" : {
"position" : "none"
},
"id" : "602833496",
"type" : "page",
"title" : "teflosin"
}
]
}
This is also working with the exception that ri:content-id is missing.
Any idea what is going wrong?
Thanks
Jörg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.