API
Macro for Assets can be read/edited via API, to automate creation of pages.
This is not available on Dashboard gadget for Assets.
Available APIs
Method | URI | Query Params | Token Scope | Token Space(s) | Description |
---|---|---|---|---|---|
GET | api_url found on API page of Macro Configuration | pageId token |
| can be limited using space list or empty to allow all spaces. | Returns an array of Macro for Assets configuration for a specific page using pageId query parameter. GET api_url/macro?pageId=1234 |
PUT | api_url found on API page of Macro Configuration | pageId token |
| can be limited using space list or empty to allow all spaces. | Updates all Macro for Assets configuration specified in the body for a specific page using pageId param. Use GET on a page to fetch format of a macro configuration. PUT instance_url/macro?pageId=1234 [
{
"id": "rxt-95ae25ba-0759-4b4e-a40f-edbdc7194067",
"configuration": {
"columns": [],
"iql": "objectType=\"Jira Users\"",
"displayAs": "AS_TABLE",
"pageSize": 5,
"schemaId": "4",
"connectionId": "45157a8a-79ad-46f7-b920-c21211bf79ec",
"tableOptions": {
"linksEnabled": true,
"downloadEnabled": false,
"printEnabled": false
}
}
}
] |
POST | api_url found on API page of Macro Configuration | spaceKey token |
| can be limited using space list or empty to allow all spaces. | Creates one or more new page(s) with Macro for Assets added and pre-configured. spaceKey determine what space to add the page in. Body takes an array of pages title and parent with macro configuration. Example; Post instance_url/page?spaceKey=ABC [
{
"title":"Page title",
"parentPageId":"id of parent page or null on root level",
"macros":[
{
"id": "rxt-95ae25ba-0759-4b4e-a40f-edbdc7194067",
"configuration": {
"columns": [],
"iql": "objectType=\"Jira Users\"",
"displayAs": "AS_TABLE",
"pageSize": 5,
"schemaId": "4",
"connectionId": "45157a8a-79ad-46f7-b920-c21211bf79ec",
"tableOptions": {
"linksEnabled": true,
"downloadEnabled": false,
"printEnabled": false
}
}
}
]
}
] |
PATCH | api_url found on API page of Macro Configuration | pageId spaceKey token |
| can be limited using space list or empty to allow all spaces. | Copies one page and creates one or more new page(s) with Macro for Assets added and pre-configured. spaceKey determine what space to add the page in. pageId determine the page to copy. Body takes an array of pages with macro configuration Example; Post instance_url/page/copy?spaceKey=ABC [
{
"title":"Page title",
"parentPageId":"id of parent page or null on root level",
"macros":[
{
"id": "rxt-95ae25ba-0759-4b4e-a40f-edbdc7194067",
"configuration": {
"columns": [],
"iql": "objectType=\"Jira Users\"",
"displayAs": "AS_TABLE",
"pageSize": 5,
"schemaId": "4",
"connectionId": "45157a8a-79ad-46f7-b920-c21211bf79ec",
"tableOptions": {
"linksEnabled": true,
"downloadEnabled": false,
"printEnabled": false
}
}
}
]
}
] |
Steps to get started
Go to Manage Apps → Macro for Assets → Configuration
Click the API tab.
To enable API access you need to generate an access token.
Click the Generate Access Token - button to generate one or more tokens.
By default the access token will be applicable for all spaces with Read and Write permissions.
Click the Edit link to edit token permissions
Get Macro for Asset configuration and IDs via API
Make a HTTP GET request to the URL available on your API page.
Use this API when you need to retreive a Macro for Assets configuration.
Required parameters:
token = the access token (scope must be READ and space must match page space)
pageId = the page to read macro configuration values from
Response:
200 OK (application/json) When request is valid
Response Body:
400 BAD REQUEST When request is invald
Body:
Error message describing the problem
Note: Verify parameters to resolve this issue
401 UNAUTHORIZED When request is unauthorized.
Body:
Error message
Note: Verify access token permissions to resolve this issue
Update Macro for Asset configuration via API
Make a HTTP PUT request to the URL available on your API page.
Use this API when you want to update Macro for Assets configuration on a page.
You can read the current macro config using the GET api and then use those IDs to update the macro configuration using this endpoint.
Required parameters:
token = the access token (scope must be WRITE and space must match page space)
pageId = the page to store the macro config on values from
Required post body:
An array of macro configuration, use multiple configuration JSON objects to update multiple configurations on the page. Note: To update a single value this still has to be an array containing the single value entity.
Response:
200 OK When request is valid and value was updated
Body:
400 BAD REQUEST When request is invalid
Body:Bad Request
Note: Verify parameters to resolve this issue
401 UNAUTHORIZED When request is unauthorized.
Body: Unauthorized
Â
Create Page with Macro for Asset configuration via API
Make a HTTP POST request to the URL available on your API page.
Use this when you want to programatically create a new page with the Macro for Asset on it with pre-configured settings.
Required parameters:
token = the access token (scope must be WRITE and space must match spaceKey)
spaceKey = the spaceKey to store the page with macro config on.
Required post body:
An array of pages with macro configuration. Note: To update a single value this still has to be an array containing the single value entity.
Each array object takes a title and optional parenPageId and the list of macros to add.
Response:
200 OK When request is valid and value was updated
Body:
400 BAD REQUEST When request is invalid
Body:Bad Request
401 UNAUTHORIZED When request is unauthorized.
Body: Unauthorized
Â
Copy Page with Macro for Asset configuration via API
Make a HTTP PATCH request to the URL available on your API page.
Use this when you want to programatically copy a page and create one or more copies of that page with the Macro for Asset on it with pre-configured settings.
Required parameters:
token = the access token (scope must be WRITE and spaces must match both spaceKey for destination space and page space)
spaceKey = the spaceKey to store the page with macro config on.
pageId = the page to read the macro config on values from
Required post body:
An array of pages with macro configuration. Note: To update a single value this still has to be an array containing the single value entity.
Each array object takes a title and optional parenPageId and the list of macros to add.
Response:
200 OK When request is valid and value was updated
Body: OK
400 BAD REQUEST When request is invalid
Body:Bad Request
401 UNAUTHORIZED When request is unauthorized.
Body: Unauthorized
Â