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

How to fetch content property in cql?

Suresh Sakhare
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.
July 3, 2019

Hi,

I am trying to create content property for storing some value on page creation. I'm able to create it but not able to use it into cql functionality.

I'm referring this blog.:https://blog.developer.atlassian.com/confluence-5-7-apis/

I have added following indexed schema in plugin.xml

 <content-property-index-schema key="myindex-schema-module-key"> <key property-key="approval-plugin-data"> <extract path="approver" type="string" /> <extract path="approval-date" type="date" /> </key> </content-property-index-schema>

 

And, adding property by following ways:

Content content = contentService.find().withId(ContentId.valueOf("1234")).fetchOneOrNull(); 
JsonContentProperty property = JsonContentProperty.builder()
.content(content) .key("approval-plugin-data") .value(new JsonString("{"approver":"mjones", "approval-date":"2015-01-24"}")).build();
contentPropertyService.create(property);

 

I was able to fetch the page content property using REST call.

/rest/api/content/{id}/property/

It will show me  page property whatever I added in java class.

 

but its not working inCQL.

content.property[approval-plugin-data].approval-date > now(-7d)

it returning no result found !!!

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Upcoming Confluence Events