Systems Management Question

Querying assets via API

04/23/2018 2042 views

I'm trying to query the assets via the K1 API. The example in the doc (/machines?shaping=machine all,software limited&sorting=software.name desc&use_count=false&filtering=id lt 1000&paging=limit) works fine.

But I can't do the same with assets.

The doc tells to do it like :
GET /api/asset/assets/
So I did :
The answer is :
"message": "Asset with ID assets does not exist."
I try to replace "assets" with an asset ID :
And then get some information about it :
"ID": 22408,
"ASSET_TYPE_NAME": "Location",
"NAME": "- REPRO",
"MODIFIED": "2018-04-12 12:28:28",
"CREATED": "2018-04-12 12:28:28"

That's the better information I can get. No query like filtering or shaping works on assets as they works on machines. Only giving the asset id works.

Do some of you succeed in querying assets ?

Answer Summary:
1 Comment   [ + ] Show comment


  • I used Postman to verify /api/asset/assets/ is working. Can you give us more details about the headers, version of appliance and what programming language or tool you used.
    • Currently i'm using postman too. K1000 v.8.1.108

      First I authenticate :
      POST /ams/shared/api/security/login HTTP/1.1
      Host: k1000.univ-ubs.fr
      Accept: application/json
      Content-Type: application/json
      Cache-Control: no-cache

      "password" : "apimanPass",
      "userName" : "apiman",
      "organizationName" : "UBS-CGP"

      Then I'm querying the assets with the csrf token sent by the api :

      GET /api/asset/assets/ HTTP/1.1
      Host: k1000.univ-ubs.fr
      Accept: application/json
      Content-Type: application/json
      x-dell-csrf-token: 3edc622125b0417b2321e1cdd2476719ec01d8cf0afa896f99c6f604e898a196409b000fef11daa7a7fa143d9c9023ebef4edfb5ca473954db8a85aef15a9a48
      Cache-Control: no-cache

      And I received a 404 not found...

      Without the ending / the response is :
      {"message": "Asset with ID assets does not exist."}

Answer Chosen by the Author

In your GET header, try adding "x-dell-api-version" with a value of "8"

I was using "1" for that value and it worked for inventory queries but I received the error "API disabled" when I attempted to query assets. Changing to "8" resolved the problem and I was able to get asset data.
Answered 05/04/2018 by: JasonEgg
Red Belt

  • It looks like it did the trick ! Thankyou.