Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get Page's version from API

krzychus April 28, 2015

Hello,

regarding this documentaion: https://developer.atlassian.com/confdev/confluence-rest-api/confluence-rest-api-examples#ConfluenceRESTAPIExamples-Updateapage  the section "Read content and expand the body" in the response there is NO version number... so how can I get this version number when I want to update certain page? How can I do this? 

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2015

Something like:

http://localhost:1990/confluence/rest/api/content/2064387?expand=version

expand parameter could get additional flags, specified in csv format

expand=version,body.format,history

 

everything you see under "_expandable" node in returned json

Krishna M Digvijai February 21, 2018

@Alex Medved _ConfiForms_  I am able to get all version number.I have to filter versions for latest version number  Is there any way to get only latest version number using API search? 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2018

when you do a request to the same API, and dont specify the "expand" parameter, you will get the default view/data for the page/content - it contains the version details (latest version)

 

Something like (see info in bold):

 

{
"id": "1212451",
"type": "page",
"status": "current",
...
"version": {
"by": {
"type": "known",
"username": "",
"userKey": "",
"profilePicture": {
"path": "/download/attachments/557058/user-avatar",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "",
"_links": {
"self": ""
}
},
"when": "2018-01-20T03:59:08.505-05:00",
"message": "",
"number": 33,
"minorEdit": false,
...
0 votes
Denis Abreu Zerum April 22, 2019
curl -s --header "Authorization: Basic xXxwcG9xXxXxXxXxXxXxXx06emVydW1xd2UxMjXxXx==" \
-X GET "https://zerumbr.atlassian.net/wiki/rest/api/content/123456789?expand=version" \
| jq ".version.number"
0 votes
Krishna M Digvijai February 21, 2018

Thanks @Alex Medved _ConfiForms_ . I am looking for direct endpoint which return version no only  like page/content /{contentId}/version?expand=latest. that will return only latest version. Again thanks for your reply

TAGS
AUG Leaders

Atlassian Community Events