/bundles/itninjaweb/img/Breadcrumb_cap_w.png
Hello,

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 :
https://k1000/api/asset/assets
The answer is :
{
"message": "Asset with ID assets does not exist."
}
I try to replace "assets" with an asset ID :
https://k1000/api/asset/22408
And then get some information about it :
{
"ID": 22408,
"ASSET_TYPE_ID": 1,
"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 ?





1 Comment   [ - ] Hide Comment

Comments

  • 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."}
Please log in to comment

Answer this question or Comment on this question for clarity

Answers

1
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.
Please log in to comment