It can sometimes be quite tedious to manually apply attributes to a large amount of existing Scroll Version pages via the Scroll Versions User Interface. The Scroll Versions Variant Management UI uses a REST API list and applies attributes. That REST API can also be used in scripts to automate this process.

Warning

The REST API functionality described on this page is considered internal and therefore not officially supported. This means that the REST API may change in future.

To automatically set attributes using REST:

  1. Get a list of all attributes and values for a given space:

    Request to list space attributes

    GET: http://<host>:<port>/<contextpath>/rest/scroll-versions/1.0/attribute/<spaceKey> 
     
    For example:
    GET: http://localhost:1990/confluence/rest/scroll-versions/1.0/attribute/MDOC
    CODE

    That will response the following:

    Response

    ["id": <attributeId>, "name" : <attributeName>, "values":[{"id": <valueId>, "name" : <valueName>}]]
     
    For example:
    [{"id":"C0A81194013F85E4D708347C1B3CF8FF","name":"Deployment Type","values":[{"id":"C0A81194013F85E4D708AB280D8F63AA","name":"AOD"},{"id":"C0A81194013F85E4D70856EF40D834DA","name":"BTF"}]}]
    CODE
  2. Request to add attribute value(s) to a page:

    Request to add attribute values for a given page

    POST: http://<host>:<port>/<contextpath>/rest/scroll-versions/1.0/metadata/page/<confluencePageId>
    <attributeId> : { <attributeValueId> : true }
     
    For example:
    // adds the 'AOD' value of the attribute 'Deployment Type' to the confluence page '533232'
    POST: http://localhost:1990/confluence/rest/scroll-versions/1.0/metadata/page/533232
    {"C0A81194013F85E4D708347C1B3CF8FF":{"C0A81194013F85E4D708AB280D8F63AA":true}}
    CODE
  3. Get a list of attribute value(s) for a page:

    Request to get a list of attribute value(s) for a page:

    GET: http://<host>:<port>/<contextpath>/rest/scroll-versions/1.0/metadata/page/<confluencePageId>
    CODE

    That will response the following:

    Response

    {"attributeValues":{<attributeId>:{<valueId>:true}}} 
     
    For example:
    {"attributeValues":{"C0A81194013F85E4D708347C1B3CF8FF":{"C0A81194013F85E4D708AB280D8F63AA":true}}} 
    CODE