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:
Get Page By Id V2
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-resourceswith 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 usedhttps://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 ?
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 } ]
{ATLASSIAN_DOMAIN}/wiki/api/v2/custom-content/2654211
Facing same issue
It looks like you're new here. Sign in or register to get started.