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.
Hi , I am also experiencing the same issue this is my schema. I am facing the 404 issues in the backend when I try to find the space using the id. In the postman I am using the basic auth but in the schema below ouath-bearer auth. The api are
https://name.atlassian.net/wiki/api/v2/spaces?keys=name (get)
https://name.atlassian.net/wiki/api/v2/pages (post).
Have i made a mistake here?
openapi: 3.1.0
info:
title: Atlassian Confluence API
version: 1.0.0
servers:
- url: https://sample.atlassian.net/wiki/api/v2
- description: Confluence Server
paths:
/spaces:
get:
operationId: getSpaceInformation
summary: Retrieve space information
parameters:
- in: query
name: keys
required: true
schema:
type: string
description: The key of the space to retrieve
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
id:
type: string
security:
- bearerAuth: []
/pages:
post:
operationId: createPage
summary: Create a new page
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
spaceId:
type: string
status:
type: string
title:
type: string
parentId:
type: string
body:
type: object
properties:
representation:
type: string
example: storage
value:
type: string
required:
- spaceId
- status
- title
- body
responses:
'200':
description: Page created successfully
security:
- bearerAuth: []
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
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.