Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I want to update a page via POSTMAN

Leeooos July 19, 2019

hi, i want to update my confluence page created via postman.

i get the below details from the website

in the below what is ID? is that the page ID? which we get from Page Information

curl -u admin:admin -X PUT -H 'Content-Type: application/json' -d '{"id":"3604482","type":"page", "title":"new page","space":{"key":"TST"},"body":{"storage":{"value": "<p>This is the updated text for the new page</p>","representation":"storage"}}, "version":{"number":2}}' http://localhost:8080/confluence/rest/api/content/3604482 | python -mjson.tool

1 answer

0 votes
Thomas Deiler
Community Champion
July 19, 2019

Dear @Leeooos ,

yes: 3604482 is the page ID of the page you want to update. Don't forget to increase the version number by one (current page version = 2, then new version = 3).

For what is that "python "mjson.tool"? The curl request doesn't require this.

So long

Thomas

Leeooos July 19, 2019

thank you Thomas.

Leeooos July 19, 2019

when i tried to put a content with the below command

{"id":"169052728","type":"page",
"title":"NewPage","space":{"key":"TST"},"body":{"storage":{"value":
"<p>This is the updated text for the new page</p>","representation":"storage"}},
"version":{"number":2}}

 

i get the folllowing response. can you please help on this

{
"statusCode": 400,
"data": {
"authorized": true,
"valid": false,
"errors": [
{
"message": {
"key": "You can't change an existing page's space.",
"args": []
}
}
],
"successful": false
},
"message": "Could not update Content of type : class com.atlassian.confluence.pages.Page with id 169052728"
}{
"statusCode": 400,
"data": {
"authorized": true,
"valid": false,
"errors": [
{
"message": {
"key": "You can't change an existing page's space.",
"args": []
}
}
],
"successful": false
},
"message": "Could not update Content of type : class com.atlassian.confluence.pages.Page with id 169052728"
}

Thomas Deiler
Community Champion
July 19, 2019

Dear @Leeooos ,

I have no clue about this error message, but in your request there is the parent page missing. This is not documented and was one year ago required to create and update pages.

{"id":"169052728","type":"page",
"title":"NewPage", "ancestors": ["id":"<the parent page id>"],"space":{"key":"TST"},"body":{"storage":{"value":
"<p>This is the updated text for the new page</p>","representation":"storage"}},
"version":{"number":2}}

No guarantee, but for me this worked.

So long

Thomas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events