PUT Request without version number?

Deleted user April 5, 2018

Hi,

Quick question:

Can I do a PUT Request to Confluence API without having the version number updated?

This is JSON I sent:

 

{

"version": {

 "number": 6
},
 "title": "Does it work?",
 "type": "page",
 "body": {
  "storage": {
   "value": "<p>This is just TEXT I want to add</p>",
   "representation": "storage"
   }
  }
}

 

I want to increment the version counter automatically by one, because I will not know which version is next.

2 answers

0 votes
Battlebeard
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2018

Hi Adrian,

Thanks for reaching out to Atlassian community. 

I have been looking into your question and can confirm the version number is a required parameter of the JSON request, so you would not be able to have confluence auto increment the version.

The only workaround I can suggest to this is to use the GET content REST API call to retrieve the current version number.

Here is an example curl command:

curl -D- -u $userName:$passWord -X GET -H "Accept: application/json" https://$confluenceInstanceUrl/rest/api/content/$contentId?expand=version


This could be worked into a script in which you extract the version from the JSON response, increment that by 1 and feed it into the JSON of your PUT command.

I hope this helps somewhat even though it's not exactly what you were looking for. 

Let us know if there is anything else.

Thanks,

Nero

0 votes
Battlebeard
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2018

[Removed double post]

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events