Permission error (403) when attempting to update a page
Asked by Walter Warniaha:

I'm getting the following response when attempting to update the content on an existing page: <https://seagate-systems.atlassian.net/wiki/rest/api/content/1069023297>

{"statusCode":403,"data":{"authorized":false,"valid":true,"errors":\[\],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.PermissionException: Could not update Content of type : class com.atlassian.confluence.pages.Page with id 1069023297"}

I get the body.storage.value from a GET (which succeeds):  
<https://seagate-systems.atlassian.net/wiki/rest/api/content/1069023297?expand=body.storage,version,space>  
I'm following the instructions from this page to update the contents:  
<https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-id-put>  
payload:  
{  
"version": {  
"number": 5  
},  
"title": "DAOS/CORTX S3 tests results page",  
"type": "page",  
"status": "current",  
"space": {  
"id": 458755,  
"key": "PUB"  
},  
"body": {  
"storage": {  
"value": "*\<content removed because of its size\>*",  
"representation": "storage"  
}  
}  
}  
Python code used to update page:  
updateurl = "<https://seagate-systems.atlassian.net/wiki/rest/api/content/1069023297>"  
updateheaders = {  
"Accept": "application/json",  
"Content-Type": "application/json",  
"Authorization": "*\<my email\>* :*\<token removed\>*"  
}  
response = requests.request("PUT", updateurl, data=payload, headers=updateheaders)  
Its not clear in the docs as to which fields need to be updated. I suspect body.storage.value is not correct, but I don't know what field(s) I should be setting with the content.  
Any help would be appreciated,  
Walter


Answers:
author: Jessica
body: Hi [@Walter Warniaha](/t5/user/viewprofilepage/user-id/4886412)

Welcome to the Atlassian Community!

By the error 403, I think the page itself might not be available for you to **edit** .  
To quickly confirm that, can you check if the page is editable for you in the UI as well?

If you have no restrictions allowing you to edit, you may need to get in touch with your site-administrator to check if you can have the restrictions for this page in order to be able to edit it.

Other than that, the payload seems right, and if there was any issues with the body.storage value or something in the payload itself, it would probably return another error, such as 400 or 500 in this case.  

For future cases and reference, you can check the errors and possible causes here in the official documentation, under responses:

* <https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-id-put-responses>

We'll be looking forward to hearing from you!  
Jessica

comments: author: Walter Warniaha
body: Hi Jessica

I created that page. I tried editing it in the UI and I was able to edit it. I'll check with the site admin.

Thanks,

Walter


author: Jessica
body: Thank you for letting me know, Walter!

<br />

If you have the permissions to the space and to the page restrictions (if there is any), then the 403 error message is weird, as generally it is the case.

Another test I'd suggest, would be creating a new page for you and restrict it only to you for testing purposes.  
Use the same endpoint and body and changing only a few things in the payload, so you can update the page to see if that will work.

Another thing you might want to try, is removing the id in the space, the key should work without any issues there.

If you feel like it is needed to check the storage value, due to its size and the data in there, if you would like to share, but not with the public here, feel free to ask your **site-admin** to open a new ticket with us at **<https://support.atlassian.com/contact/>**   
There we also should be able to check some other things with you in regards to the site itself, if needed.

Let us know if anything else happens and the behavior changes. :)  

Cheers,  
Jessica


Tags: cloud

confluence-cloud