SW API - retrieve the computer based on the owner

Hello,


I'm starting using API since fews days now and followed somes course as also read the following documentations from Solarwind : 

-https://apidoc.samanage.com/

-https://documentation.solarwinds.com/en/success_center/swsd/content/completeguidetoswsd/token-authentication-for-api-integration.htm

i think i'm understanding how the whole thing is working but i'm struggling a bit, let me explain.

I've a catalog service for user to request an account closure when someone leave the company, when it's come to the hardware part we need to find the computer associated to the user ( the "Owner"), then create another ticket ( based on another service catalog which will  trigger severals step as updating location, status, owner,ask the manager to send back the computer ...

As it's seem not possible to do that automatically with process i was thinking of using API.

when the requester use this service catalog ( called " Account Closure Request"), he will have to select the concerned user in the user list ( which is the one from solarwind account list).

my idea is to retrieve the concerned user id and look into the hardware inventory to find his computer !

I'm using postman to run test and when i look into the details of a computer i can see somes "subfield" in "Owner" which where the user ID is stored.

So if i know the user ID, i should be able to find the matching ID in the computer he own. 

but i'm not able to retrieve the computer based on the "user's id owner", i'm not sure how and if we can select a subfield, here's my command : 

my questions are : 

- is it possible to retrieve user's computer based on the user's ID ? or may be should i use another field ?

- how do i select a subfield in API ?

Thanks for the help you can give !

Parents
  • I contacted SWSD Support, and it seems that it is currently impossible to query nested elements, but you can query by the user ID if that's a workaround you can use. To do this just go to your hardware tab and filter by user, you can then see what the ID is in the URL. Here is an example: 




    Your new call would then be:

    GET https://api.samanage.com/hardwares.json?owner=11675818

    Obviously, this isn't perfect, but it could be a possible workaround depending on your environment. Have a great day!

Reply
  • I contacted SWSD Support, and it seems that it is currently impossible to query nested elements, but you can query by the user ID if that's a workaround you can use. To do this just go to your hardware tab and filter by user, you can then see what the ID is in the URL. Here is an example: 




    Your new call would then be:

    GET https://api.samanage.com/hardwares.json?owner=11675818

    Obviously, this isn't perfect, but it could be a possible workaround depending on your environment. Have a great day!

Children
No Data