It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

PUT Request without version number?

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

[Removed double post]

0 votes
Battlebeard Atlassian Team Aug 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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Introducing Confluence Cloud and Jira Software Cloud Premium

Wherever you are in your team’s journey , our goal is to support your big ambitions. We’re a cloud-first company with the mission of unleashing the potential of every team, and to address the range ...

590 views 4 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you