/build/static/layout/Breadcrumb_cap_w.png

Querying assets via API

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   [ + ] 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. - KevinG 6 years ago
    • 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."} - gwir 6 years ago

Answers (1)

Answer Summary:
Posted by: JasonEgg 6 years ago
Red Belt
1

Top Answer

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.

Comments:
  • It looks like it did the trick ! Thankyou. - gwir 6 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ