curl --location --request GET 'https://{ATLASSIAN_DOMAIN}/wiki/rest/api/content/{id}' \
--header 'Authorization: Bearer {ACCESS_TOKEN}
RESPONSE:
{
"message": "Current user not permitted to use Confluence",
"statusCode": 403
}
Using Rest API V2: There is no API documentation for v2 for getting content by pageId.
However, I tried using the V2 GET Page By Id:
curl --location --request GET 'https://{domain-name}.atlassian.net/wiki/api/v2/pages/2654211' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--header 'Accept: application/json'
Response:
{
"errors": [
{
"status": 404,
"code": "NOT_FOUND",
"title": "Not Found",
"detail": null
}
]
}
I can retrieve and see the scopes by calling
https://api.atlassian.com/oauth/token/accessible-resources
with the Access_Token:
curl --location --request GET 'https://api.atlassian.com/oauth/token/accessible-resources' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--header 'Accept: application/json'
"scopes": [
"write:space:confluence",
"read:content-details:confluence",
"read:space-details:confluence",
"read:space.permission:confluence",
"read:space:confluence",
"read:custom-content:confluence",
"write:content.property:confluence",
"write:page:confluence",
"read:content.property:confluence",
"read:user:confluence",
"write:content:confluence",
"read:content.permission:confluence",
"read:content:confluence",
"read:attachment:confluence"
],
I found the problem while using the access-token obtained from AuthGrantCode.
I was using the https://{company-name}.atlassian.com/...;whereas, i should have used
https://api.atlassian.com/ex/confluence/{cloudID}/{api}
The cloudid - can be obtain from :
curl --location 'https://api.atlassian.com/oauth/token/accessible-resources' \
--header 'Authorization: Bearer AccessTOKEN' \
--header 'Accept: application/json'
/// Access Token Obtained using AuthGrantCode (in my case)
api: is the format from REST API V2: (REST API V2 )
/wiki/api/v2/pages/{pageID}?body-format=storage
So, the resulting api url will look like:
https://api.atlassian.com/ex/confluence/{cloudID}/wiki/api/v2/pages/{pageID}?body-format=storage
or..
curl --location 'https://api.atlassian.com/ex/confluence/{cloud-ID}/wiki/api/v2/pages/{PAGE_ID}?body-format=storage' \
--header 'Authorization: Bearer Access_Token' \
--header 'Accept: application/json'
Detail Doc / explanation can be found here : OAuth 2.0 (3LO)
NOTE: Must have necessary granular scopes that you can grant permission to in the developer console..
hope this helps.
Hi @Mohammad Zaman and welcome to the community,
Have you try using https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-custom-content/#api-custom-content-id-get ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alex Koxaras _Relational_ ,
Thank you for replying. I tried with custom-content by Id, i still get 404
{
"errors": [
{
"status": 404,
"code": "NOT_FOUND",
"title": "Not Found",
"detail": null
}
]
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.
Facing same issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
curl --location --request GET 'https://{DOMAIN_NAME}.atlassian.net/wiki/rest/api/content/{PageID}?expand=body.view'
--header 'Authorization: Bearer {BEARER_TOKEN}'
Response:
{
"message": "Current user not permitted to use Confluence",
"statusCode": 403
}
Using JWT Access_Token did not work neither for Rest Api V1 nor V2. Using the PAT (Personal Access Token) worked.
Personal Access Token
REST API V1
curl --request GET \
--url 'https://{DOMAIN_NAME}.atlassian.net/wiki/rest/api/content/{pageId}'?expand=body.view \
--user 'email@example.com:<PERONAL_ACCESS_TOKEN>' \
--header 'Accept: application/json'
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.
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.