4

I added an attachment successfully to the confluence page but i am unable to update that page. I do have admin permissions to create a page and edit it. I do not know why its not working. Below is the command that i have used to update a page in confluence.

curl -u username:password -X PUT -H 'Content-Type: application/json' -d'{"id":"pageid","type":"page","title":"LOAD-UI REPORTS","space":{"key":"TST"},"body":{"storage":{"value":"<p>This is the updated text for the loadui reports page</p>","representation":"storage"}},"version":{"number":2}}' https://jira.hilton.com/confluence/rest/api/content/pageid  | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
397   177    0   177    0   220    359    446 --:--:-- --:--:-- --:--:--     0
{
    "data": {
        "authorized": false,
        "errors": [],
        "valid": true
    },
    "message": "Could not update Content of type : class com.atlassian.confluence.pages.Page with id 38012230",
    "statusCode": 400
}

Please let me know what i am doing wrong here.

Sandeep
  • 81
  • 6
  • 1
    Did you increment the version.number of the page? – mtheriault Aug 19 '16 at 19:29
  • 1
    yes i did. It works now. The only issue is i need to post instead of put. I tried to post. It says json object not found. @mtheriault – Sandeep Aug 24 '16 at 16:07
  • Mmm not sure to understand... you need the 'PUT' method to update a page. 'POST' method is used to create a new page: https://docs.atlassian.com/confluence/REST/latest/#content-update. – mtheriault Aug 25 '16 at 18:34

0 Answers0