Retrieve references endpoint replaced

Deprecation notice

Beginning with the Platform 6 release, the /references-to endpoint is deprecated in favor of the /discoverReferences endpoint.

Retrieve references prior to Platform 6

In early versions of Itential Platform (IP/2022.1 through IP/2023.2), the /references-to endpoint was used to retrieve assets that reference a target asset. The endpoint requires two query parameters: target-type and target-identifiers.

The examples below demonstrate a proper GET request to /references-to and the expected response. In this example, the target asset is a workflow named childWorkflow that is referenced by two other workflows named parentWorkflow1 and parentWorkflow2.

GET request

/automation-studio/references-to?target-type=workflow&target-identifiers=a5dd53e1-0459-4616-bbe3-50b29da3a299

Response

1{
2 "referencesByTarget": [
3 {
4 "target": {
5 "identifier": "a5dd53e1-0459-4616-bbe3-50b29da3a299",
6 "type": "workflow",
7 "name": "childWorkflow"
8 },
9 "totalReferencingInstances": 2,
10 "totalReferences": 2,
11 "references": [
12 {
13 "type": "workflow",
14 "_id": "56cb9387-2238-400f-9068-6e45e8bec241",
15 "name": "parentWorkflow1",
16 "canvasVersion": 3,
17 "referencePaths": [
18 "tasks.b700.variables.incoming.workflow"
19 ]
20 },
21 {
22 "type": "workflow",
23 "_id": "96e76283-de19-4085-bb90-d8563d7a5985",
24 "name": "parentWorkflow2",
25 "canvasVersion": 3,
26 "referencePaths": [
27 "tasks.9c41.variables.incoming.workflow"
28 ]
29 }
30 ]
31 }
32 ]
33}

/references-to can only look “upward.” In a child-parent relationship like this example, running /references-to on one of the parent workflows returns no assets, since nothing is referencing either of them.

Retrieve references in Platform 6 and later

With the Platform 6 release, the /discoverReferences endpoint provides a wider range of functionality for retrieving relevant assets for a particular asset, including projects. With /discoverReferences, you can specify the direction to search relative to the target asset (up, down, or all) and whether the search should be executed recursively past just one layer up or down (recursive: true or false).

This endpoint fully encompasses the designed functionality of /references-to. The previous example can be reproduced with /discoverReferences as shown below.

POST request

/automation-studio/discoverReferences

With the following body:

1{
2 "resourceIdentifiers": [
3 {
4 "resourceType": "workflow",
5 "resourcePointer": "name",
6 "resourceId": "childWorkflow"
7 }
8 ],
9 "includeResources": false,
10 "recursive": false,
11 "include": {
12 "workflow": "up"
13 }
14}

In this example, only workflow references are searched, but any of the asset tags listed in the metadata.ignore of the response can be added to the include property with a specified direction (up, down, or all).

Response

A data array containing the root resource and the retrieved assets:

1{
2 "message": "Successfully discovered references",
3 "data": [
4 {
5 "resourceType": "workflow",
6 "resourcePointer": "/_id",
7 "resourceId": "a5dd53e1-0459-4616-bbe3-50b29da3a299",
8 "parents": [
9 {
10 "resourceType": "workflow",
11 "resourcePointer": "/_id",
12 "resourceId": "96e76283-de19-4085-bb90-d8563d7a5985",
13 "parentPointer": "/tasks/9c41/variables/incoming/workflow"
14 },
15 {
16 "resourceType": "workflow",
17 "resourcePointer": "/_id",
18 "resourceId": "56cb9387-2238-400f-9068-6e45e8bec241",
19 "parentPointer": "/tasks/b700/variables/incoming/workflow"
20 }
21 ],
22 "root": true
23 },
24 {
25 "resourceType": "workflow",
26 "resourcePointer": "/_id",
27 "resourceId": "56cb9387-2238-400f-9068-6e45e8bec241",
28 "parents": []
29 },
30 {
31 "resourceType": "workflow",
32 "resourcePointer": "/_id",
33 "resourceId": "96e76283-de19-4085-bb90-d8563d7a5985",
34 "parents": []
35 }
36 ],
37 "metadata": {
38 "ignore": {
39 "jsonForm": "all",
40 "mopCommandTemplate": "all",
41 "mopAnalyticTemplate": "all",
42 "transformation": "all",
43 "template": "all",
44 "goldenConfig": "all",
45 "compliancePlan": "all",
46 "resourceModel": "all",
47 "automation": "all",
48 "trigger": "all",
49 "form": "all",
50 "configParser": "all",
51 "configSpec": "all",
52 "deviceBackup": "all",
53 "deviceGroup": "all",
54 "group": "all",
55 "integrationModel": "all",
56 "jsonSpec": "all",
57 "project": "all",
58 "role": "all",
59 "serverProfile": "all",
60 "serviceConfig": "all",
61 "tag": "all",
62 "user": "all"
63 }
64 }
65}

If you set includeResources to true in the POST request body, each item in the data array will include a resource property containing the entire data object for that asset.

Enable the recursive property

If you add another workflow named grandparentWorkflow that references parentWorkflow1 and switch the recursive property to true, the response includes grandparentWorkflow even though it does not directly reference childWorkflow — it is found through the recursive upward search.

Response:

1{
2 "message": "Successfully discovered references",
3 "data": [
4 {
5 "resourceType": "workflow",
6 "resourcePointer": "/_id",
7 "resourceId": "a5dd53e1-0459-4616-bbe3-50b29da3a299",
8 "parents": [
9 {
10 "resourceType": "workflow",
11 "resourcePointer": "/_id",
12 "resourceId": "96e76283-de19-4085-bb90-d8563d7a5985",
13 "parentPointer": "/tasks/9c41/variables/incoming/workflow"
14 },
15 {
16 "resourceType": "workflow",
17 "resourcePointer": "/_id",
18 "resourceId": "56cb9387-2238-400f-9068-6e45e8bec241",
19 "parentPointer": "/tasks/b700/variables/incoming/workflow"
20 }
21 ],
22 "root": true
23 },
24 {
25 "resourceType": "workflow",
26 "resourcePointer": "/_id",
27 "resourceId": "56cb9387-2238-400f-9068-6e45e8bec241",
28 "parents": [
29 {
30 "resourceType": "workflow",
31 "resourcePointer": "/_id",
32 "resourceId": "9d0784a6-c3a9-4879-bdbc-07c46ade39eb",
33 "parentPointer": "/tasks/2372/variables/incoming/workflow"
34 }
35 ]
36 },
37 {
38 "resourceType": "workflow",
39 "resourcePointer": "/_id",
40 "resourceId": "96e76283-de19-4085-bb90-d8563d7a5985",
41 "parents": []
42 },
43 {
44 "resourceType": "workflow",
45 "resourcePointer": "/_id",
46 "resourceId": "9d0784a6-c3a9-4879-bdbc-07c46ade39eb",
47 "parents": []
48 }
49 ],
50 "metadata": {
51 "ignore": { }
52 }
53}