
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-14-2020 04:46 PM
Hi,
I am trying to test the Relationship editor, and I see that there is a Quick Start ATF test and it works. However the REST Post step that calls /api/now/cmdbrelation/add-rel doesn't take any parameters.
The test creates two records and then makes a call to the /api/now/cmdbrelation/add-rel, and the relationship is added to between the two records that were created, but it seems to happen by "magic".
A later step in the test makes a call to api/now/cmdbrelation/delete-rels, And that step does specify parameters.
My question is, what are the parameters for /api/now/cmdbrelation/add-rel and /api/now/cmdbrelation/add-rels
By the way, the quick start test I'm referring to is "CMDB REL EDITOR: Relationship Editor".
I appreciate any help!
Thanks,
Cody
Solved! Go to Solution.
- Labels:
-
Automated Test Framework

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-27-2020 10:23 AM
Well, I tracked down the body content for the POST messages.
The -- sys_id -- marker is where the sys_id of the Cis need to be.
api/now/cmdbrelation/delete-rel
{
"parentId": "-- sys_id --",
"childId": "-- sys_id--",
"relationTypeId": "1a9cb166f1571100a92eb60da2bce5c5",
"type": "cmdb_ci",
"isSuggestedRelationship": "true"
}
api/now/cmdbrelation/delete-rels
{
"item": [
{
"type": "Hosted on::Hosts",
"type_id": "5f985e0ec0a8010e00a9714f2a172815",
"child": "CMDB_ATF_RE_linux100",
"child_id": "--sys_id--",
"parent": "CMDB_ATF_RE_MySQL-16006",
"parent_id": "--sys_id--",
"sys_id": "",
"relationshipType": "ci_upstream"
},
{
"type": "Hosted on::Hosts",
"type_id": "5f985e0ec0a8010e00a9714f2a172815",
"child": "CMDB_ATF_RE_linux100",
"child_id": "--sys_id--",
"parent": "CMDB_ATF_RE_MySQL-16004",
"parent_id": "--sys_id--",
"sys_id": "",
"relationshipType": "ci_upstream"
}
],
"type": "cmdb_ci",
"isSuggestedRelationship": "true"
}
Hope this helps someone!
Thanks,
Cody

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2020 07:08 AM
Hi Cody,
the table that holds all CI relationships is cmdb_rel_ci .
In which quick start test suit did you find that test?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2020 07:19 AM
oh and btw: you could always user the normal table api to create CI relationships:
/api/now/table/cmdb_rel_ci
you can easily test that in the REST API explorer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2020 07:23 AM
All the relationships are stored in cmdb_rel_ci table.So it will be:
The best way i tell you just go to REST API explorer type the table name & you will get the end point.
If table name is unknown in any case just open a record & the URL is displaying it.
/api/now/table/cmdb_rel_ci
Complete end point:
https://<instance name>.service-now.com/api/now/table/cmdb_rel_ci
Thanks
Sudhanshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2020 02:31 PM
the POST contains this JSON:
{"parentId":"{{Step 6: Record Insert.Record}}","childId":"{{Step 5: Record Insert.Record}}","relationTypeId":"1a9cb166f1571100a92eb60da2bce5c5","type":"cmdb_ci","isSuggestedRelationship":"true"}