Introduction
By default within IriusRisk, the API does not show nested components within the API response, however it is possible to work around this by making use of component tags, and therefore ultimately being able to identify nested components within an IriusRisk API response.
How can I achieve this?
For this example, we will use the following API endpoint to retrieve components for a particular project:
https://<DNS>.iriusrisk.com/api/v1/products/<project_ref>
The API response for this endpoint has all components within one sub-collection, meaning all components are treated as the same in regards to hierarchal order. This article will focus on tagging nested components, which can help users or automations determine which components are nested.
Example response:
{
"ref": "some-project",
"name": "Some Project",
"isSyncing": false,
"revision": 1,
"type": "STANDARD",
"status": "OPEN",
"priority": 0,
"tags": null,
"workflowState": "new-project",
"modelUpdated": "2024-01-10 15:20:54",
"desc": null,
"questions": [],
"assets": [],
[...],
"components": [
{
"uuid": "xxxx",
"ref": "xxxxx",
"name": "Some component",
"desc": null,
"groupName": null,
"tags": [],
[...]
},
{
"uuid": "xxxx",
"ref": "xxxxx",
"name": "Some nested component",
"desc": null,
"groupName": null,
"tags": [],
[...]
},
[...],
[...]
As you can see above, there is no way to determine if a component is nested, so this workaround stems from using tags within a project, below you can see the workflow for this:
Login to IriusRisk > Projects > Choose your desired project > Right click on a nested component(s) > Component details > Create a tag named "Nested".
Example response:
{
"ref": "some-project",
"name": "Some Project",
"isSyncing": false,
"revision": 1,
"type": "STANDARD",
"status": "OPEN",
"priority": 0,
"tags": null,
"workflowState": "new-project",
"modelUpdated": "2024-01-10 15:20:54",
"desc": null,
"questions": [],
"assets": [],
"components": [
{
"uuid": "xxxx",
"ref": "xxxxx",
"name": "Some component",
"desc": null,
"groupName": null,
"tags": [],
[...]
},
{
"uuid": "xxxx",
"ref": "xxxxx",
"name": "Some nested component",
"desc": null,
"groupName": null,
"tags": ["Nested"], <---- This component is now tagged as nested
[...]
},
[...],
[...]
Users will be able to easily identify the nested components by retrieving "tags" from the API response or by checking the tags via the UI.
Drawbacks to this implementation
The main drawback to this implementation is that it must be maintained by the users, and if a diagram/component(s) move regularly within the project then it is up to the user to update the tags for the component(s).
Comments
0 comments
Please sign in to leave a comment.