REST error, MISSING_DEPENDENCY

Henrik Jutterst
Tera Guru

I need some input on how to resolve an issue I have when I would like to add a CI via REST API.

I'm kind of new to REST API, and I don't know how to resolve this issue or where to see what is supposed to be submitted in my payload. (I'm using Postman for this purpose)

 

POST https://instance-name.service-now.com/api/now/cmdb/instance/cmdb_ci_storage_volume

{
    "attributes": {
    "name": "heju-test-20190121-001",
    "fqdn": "heju-test-20190121-001",
    "company": "d9efdcacdb4a620076fabc2ffe9619a8",
    "location": "6b059335dbd18f0076fabc2ffe9619c9",
    "storage_type": "LUUN",
    "last_discovered": "2019-01-21 08:33:29",
    "short_description": "Here's a newly created CI created from ServiceNow API",
    
    "dns_domain": "blank-heju",
    "ip_address": "10.14.121.124",
    
    "disk_space": "4000",
    "type": "Runs on::Runs",
    "child": "0"
  },
  "source": "ServiceNow"
}

 

Response:

{
    "result": {
        "items": [
            {
                "sysId": "Unknown",
                "identifierEntrySysId": "Unknown",
                "errors": [
                    {
                        "error": "MISSING_DEPENDENCY",
                        "message": "In payload no relations defined for dependent class [cmdb_ci_storage_volume] that matches any containment/hosting rules: [cmdb_ci_storage_volume >> Contained by >> cmdb_ci_computer,cmdb_ci_storage_volume >> Owned by >> cmdb_ci_storage_cluster,cmdb_ci_storage_volume >> Hosted on >> cmdb_ci_logical_datacenter]. Add appropriate relations in payload for '{\"className\":\"cmdb_ci_storage_volume\",\"values\":{\"storage_type\":\"LUUN\",\"short_description\":\"Here's a newly created CI created from ServiceNow API\",\"fqdn\":\"heju-test-20190121-001\",\"ip_address\":\"10.14.121.124\",\"last_discovered\":\"2019-01-21 08:33:29\",\"disk_space\":\"4000\",\"type\":\"Runs on::Runs\",\"discovery_source\":\"ServiceNow\",\"name\":\"heju-test-20190121-001\",\"dns_domain\":\"blank-heju\",\"company\":\"d9efdcacdb4a620076fabc2ffe9619a8\",\"location\":\"6b059335dbd18f0076fabc2ffe9619c9\",\"child\":\"0\"}}'"
                    },
                    {
                        "error": "ABANDONED",
                        "message": "Too many other errors"
                    }
                ],
                "identificationAttempts": []
            }
        ],
        "relations": [],
        "logContextId": "c565f183db0f6f408956f3d61d961979"
    }
}

 

find_real_file.png

1 ACCEPTED SOLUTION

Henrik Jutterst
Tera Guru
11 REPLIES 11

dvp
Mega Sage
Mega Sage

use below url

https://instancename.service-now.com/api/now/table/cmdb_ci_storage_volume

Is there a field called "fqdn" on cmdb_ci_storage_volume table

    "fqdn": "heju-test-20190121-001",

and request body should be something like this

{"name":"test","company":"d9efdcacdb4a620076fabc2ffe9619a8"}

Also i would encourage you to try in REST API Explorer in servicenow

Here is link https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/task/t_Get...

 

Hi,

Using the suggested URL does not solve the issue. Instead, no records are added using this URL. I get a Status 201 Created. But none of the input gets added to the CI that is created.

Any other ideas?
Also, adding direct to table bypasses the mandatory fields, so that's not a good idea.

I think API is expecting one of the relationship between storage volume and either of computer, cluster or datacenter.

 cmdb_ci_storage_volume >> Contained by >> cmdb_ci_computer,

cmdb_ci_storage_volume >> Owned by >> cmdb_ci_storage_cluster,

cmdb_ci_storage_volume >> Hosted on >> cmdb_ci_logical_datacenter

 

Is your storage volume record is related to any of the above classes?

How would such a payload look - referring to submitted code in main question?