Hi community!
I'm facing an issue when I'm trying to create a page on confluence cloud using API v2.
When I use this
GET 'https://companyname.atlassian.net/wiki/api/v2/pages'
I have results correctly but when I use the API to create a new page I have 404
POST
https://companyname.atlassian.net/wiki/api/v2/pages
with this body
As mentioned here:
https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-post
404 Not Found
Returned if:
Check the space permissions.
Ive tested this:
https:/my.atlassian.net/wiki/api/v2/pages with a POST and this body and it works.
{
"spaceId": "33009",
"status": "current",
"title": "Interesting page title",
"parentId": "33096",
"body": {
"representation": "storage",
"value": "<p>The page content</p>"
}
}
Regards
Aaron
Thanks @Aaron Pavez _ServiceRocket_ for your quick reply.
Can you help my on checking my permission? Because with my user I can create pages on the space so I don’t know where the problem about permissions is.
thanks again
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you test the body I used? On yours, you are missing this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aaron Pavez _ServiceRocket_ yes I used also the same body you used but same error.
I’m using my API token the same I use for the other API (get pages) that works.
Maybe I’m wrong with the space and parent id? Is there a friendly way to get them, I mean get them directly from Confluence pages?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again!
The Space ID? Not from the UI, only with API.
/wiki/rest/api/space/SPACEKEYHERE
Double check the space ID and parent page ID.Y
You can get the page ID from the UI by going to More actions -> Advanced details -> Page information
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nope :/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Can you try the curl command from the Atlassian page?
curl --request POST \
--url 'https://{your-domain}/wiki/api/v2/pages' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"spaceId": "<string>",
"status": "current",
"title": "<string>",
"parentId": "<string>",
"body": {
"representation": "storage",
"value": "<string>"
}
}'
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Aaron Pavez _ServiceRocket_ now it works, I don't know how but in postman I had a problem with my token :(
Thanks for the support!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
How? I'm using the curl with Postman but don't know how to use it in the Atlassian page :/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With postman you dont need to user curl.
add the URL
in authorization
- Username: use your email
- Password: your token
the body is the one I've shared earlier. select raw and JSON at the end.
That should do it.
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here you have:
1) the API that works (Get Pages)
2) the API that doesn't work (Create Page)
Same url, same user, same API token ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.