Jump to content

Recommended Posts

Posted

I am currently testing in Postman, sending createAsset and UpdateAsset2 commands to Hornbill.

I have come across a couple of issues which I require some help with.

As a note, I have been following the guidance for both here Service Manager API Reference - Entity API / createAsset and here Service Manager API Reference - Entity API / updateAsset2

Not sure if I am missing something in the guidance but it seems to be missing key information, where is the information around generalProperties and additionalProperties? They are both not simple strings that can be passed, from searching on your forums they should be something along the lines of "generalProperties":"[{\"name\":\"description\",\"value\":\"did this work?\"},{\"name\":\"notes\",\"value\":\"did this work?\"}]"

 

Regardless of the above, here are the 2 issues I am facing -

 

1. When using the createAsset command (Parsing JSON, my endpoint and API key are in the headers)

{
  "@service": "apps/com.hornbill.servicemanager/Asset",
  "@method": "createAsset",
  "params": {
    "assetClass": "Computer System",
    "generalProperties": "{\"name\" :\"999999999999\",\"description\" :\"test description\"}"
  }
}
 
It returns 
 
{
    "@status": false,
    "state": {
        "code": "0207",
        "service": "apps",
        "operation": "createAsset",
        "error": "/apps/com.hornbill.servicemanager/entities/AssetsTypes/fc_modules/asset_type_helper.js(90): error X1001: Uncaught EspDatabaseConnection::prepareArgForQuery: Invalid input value, undefined not allowed",
        "flowcodeError": {
            "where": "Execute",
            "filename": "/apps/com.hornbill.servicemanager/entities/AssetsTypes/fc_modules/asset_type_helper.js",
            "lineNumber": 90,
            "columnPos": 40,
            "message": "Uncaught EspDatabaseConnection::prepareArgForQuery: Invalid input value, undefined not allowed",
            "errorCode": 1001,
            "stackTrace": [
                "getAssetTypeRecord at /apps/com.hornbill.servicemanager/entities/AssetsTypes/fc_modules/asset_type_helper.js(90:41)",
                "addAsset at /apps/com.hornbill.servicemanager/entities/Asset/fc_modules/sm_asset_helper.js(372:53)",
                " at /apps/com.hornbill.servicemanager/entities/Asset/fc_ops/createAsset.js(10:26)"
            ]
        }
    }
}
 
2. When using the updateAsset2 command (parsing JSON, my endpoint and API key are in the headers)
 
{
  "@service": "apps/com.hornbill.servicemanager/Asset",
  "@method": "updateAsset2",
  "params": {
    "assetId": "7689",
    "assetClass": "Telecoms",
    "generalProperties": "{\"description\" :\"This Asset Type is for DDI Numbers\"}"
  }
}
 
It returns 
 
{
    "@status": true,
    "params": {
        "assetId": "7689"
    }
}
 
Yet there are no changes to asset 7689 in Hornbill.
Posted
Invalid input value, undefined not allowed

That looks a lot like you're missing mandatory values. (Although see the final point)

I'm pretty sure the Class is "computer" rather than "Computer System"

I'm not so sure on this one, but I believe the properties (as in the example you found) should be arrays.

Posted
18 minutes ago, Steve Giller said:
Invalid input value, undefined not allowed

That looks a lot like you're missing mandatory values. (Although see the final point)

I'm pretty sure the Class is "computer" rather than "Computer System"

I'm not so sure on this one, but I believe the properties (as in the example you found) should be arrays.

Thanks for coming back to me so quickly.

Is there any guidance somewhere on what options are available for "generalProperties" and "additionalProperties"?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...