Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,176
Community Members
 
Community Events
168
Community Groups

How do I write scaffolding macro data into parameters via Rest API?

Can anyone help me with this? I already found out a way how to write into these macros but I dont get how to read from them.  This is how to write into the macros. (Using the Scaffolding REST API with ScriptRunner for Confluence - Scaffolding Forms & Templates (servicerocket.com))

1 answer

1 accepted

Hi Lennard,

Please allow me to answer your queries.

Before we proceed, may I know whether the use of ScriptRunner is required at the moment? As if we would like to write the structure of the REST API, we can follow this article instead as a starter:

First, we can get the Scaffolding form structure by using the mentioned GET method. Below is an example of my form retrieved using the GET method where there are 2 Text Data's, a List Data with its options, and a Date Data.

[
{
"macro": "text-data",
"macroId": "c7429ed3-ba43-4184-ace4-9ae674ec16d4",
"name": "project",
"type": "line",
"content": "text",
"required": false
},
{
"macro": "text-data",
"macroId": "bf98ed11-ae67-4610-9c2c-e5da6f6c9d79",
"name": "desc",
"required": false
},
{
"macro": "list-data",
"macroId": "c74210a0-73bc-4248-ab06-79e94a78756c",
"name": "status",
"multiple": false,
"options": [
{
"value": "Open",
"option": "list-option"
},
{
"value": "In Progress",
"option": "list-option"
},
{
"value": "Done",
"option": "list-option"
}
],
"required": false
},
{
"macro": "date-data",
"macroId": "479a905f-0816-4e5c-b83b-0970ec43d1bf",
"name": "due",
"required": false
}
]

As we get the form structure through the GET method, we can follow it to write the Body for the PUT method. Following the article, we can set the values below:

[
{
"macro": "text-data",
"name": "project",
"value": "Project Alpha"
},
{
"macro": "text-data",
"name": "desc",
"value": "This is the test project"
},
{
"macro": "list-data",
"name": "status",
"value": ["In Progress"]
},
{
"macro": "date-data",
"name": "due",
"value": "2022-04-02 11:11:11"
}
]

 Run the PUT request with the above JSON body including the "Content-Type: application/json" header, the form will be updated with the value set above. To help with the test, I'm using the Postman app.

In case that we misunderstand your queries or if you have any further questions, feel free to raise a ticket in our portal through the link below:
- https://servicerocket-apps.atlassian.net/servicedesk/customer/portal/1

Best Regards,
Julian.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events