How to retrieve metadata from Page Properties using REST API

Sharath Bhaskara May 23, 2016

Dear Experts, 

As per the documentation "https://developer.atlassian.com/confdev/development-resources/preparing-for-confluence-5-4" Confluence 5.4 exposes a REST API to retrieve metadata in page properties. 

image2016-5-23 11:42:14.png

But I couldn't find a way to retrieve this data from the REST Resources documenatation. https://docs.atlassian.com/confluence/REST/latest/ or previous versions, all I can see is a resource to set and get the Properties for a page stored internally and is not visible to the readers in anyway using /rest/api/content/{id}/property

Can someone help me identify the correct API to retrieve page properties metadata. 

Any help is much appreciated. 

 

-- Sharath

2 answers

1 vote
Aaron Peterson June 4, 2019

I'm posting the results of my research to fill in some details of the smartics answer.  Using curl (with netrc basic auth):

curl -n -G "https://yourconfluenceserver/confluence/rest/masterdetail/1.0/detailssummary/lines?spaceKey=YOURSPACE" --data-urlencode "cql=label=service" 

The cql stuff seems to be necessary; use a cql search that returns the pages you want.  Other examples are "cql=id=1234567890" for a specific page id or "cql=title~Demo AND space.key=MYSPACE".  
The json output can be parsed to get the page properties.  Using the jq cli tool:
`jq -r '.renderedHeadings[]'` extracts the keys
`jq -r '.detailLines[].details[]` will extract corresponding values

0 votes
Robert Reiner _smartics_
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.
June 10, 2016

I think you are looking for the masterdetail service:

rest/masterdetail/1.0/detailssummary/lines

If your are using the REST browser (plugins/servlet/restbrowser) you need to uncheck "Show only public APIs".

Just in case you are looking for services not only to access document properties but also space properties or document sections, you could have a look at the Web API Extension that is based on our commercial projectdoc Toolbox. Both are available on the Atlassian Marketplace:

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events