Switching from deprecated properties API to new API

Bianca Stadler
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 28, 2024

We have some confluence macros which we are currently updating and rewriting. Most of the use the now deprecated properties API (https://developer.atlassian.com/platform/forge/runtime-reference/properties-api/) which we are now changing to use the new API calls instead (https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-content-properties/#api-pages-page-id-properties-get).

The calls to get the properties work just fine, also the POST request to create a single property with a string value is working. However, we also have requests that set multiple properties for a page at once, and those property values are objects, not just strings, and I cannot get this to work with the new API calls..

The old request looks something like this:

 properties.onConfluencePage(contentId).set(key, value)...
where in the value, all of the property objects that need to be set are present, and they are objects. When trying something similar with the new API calls (the POST request to create a property), I get a Bad Request. When I try updating them one by one, I also get Bad Request.
Maybe I am misunderstanding the structure of the new API, and the properties, but I don't quite know what else to try.
Does anybody have a similar problem?

1 answer

0 votes
Thomas Berger November 1, 2024

The Confluence REST API V2 now uses property-id for page property keys. You can retrieve a page's property-id using Get content properties for page with the key=${propertyKey} query parameter.

From https://developer.atlassian.com/platform/forge/runtime-reference/properties-api/#properties-api--deprecated-

To update, "version: must not be null"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events