Working on a project. Currently, we don’t allow our site techs access to deleted items due to some issues we had in the past. I’m trying to create a tool that will allow them to look for a specific device and, eventually, leverage the /undelete API endpoint to do what it says on the box.
I’m running into problems finding an API endpoint that will let me locate the device in question, however. When you use the search endpoints on a device that is deleted they are unable to locate the device. The undelete endpoint requires the AssetId, which is problematic because I’m not finding a way to get the AssetId other than knowing it beforehand.
Additionally, it looks like there is an /assets/deleted endpoint which, I’m assuming, would return a list of all the deleted devices, but it returns a 404 when I send a GET request.
Anyone have any ideas? Am I doing something wrong? Any workarounds?
Best answer by CBohlmeyer 710df2e lps53View original
I don’t remember the specific path I was directed down, but I did end up putting in a ticket and IIQ support worked on this issue for a while. They got back to me with an API call that allowed me to pull a list of all the devices that are in the deleted status. Here’s the command in cURL form below:
curl --location 'https://YOURINSTANCEHERE.incidentiq.com/api/v1.0/assets/?%24s=20&%24o=AssetTag' \
--header 'accept: application/json' \
--header 'accept-language: en-US,en;q=0.9' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer YOURTOKENHERE'
It works like a charm and I was able to get the project I was working on finished!
Thank you for coming back to this comment!
I got the same thing as you with the deleted endpoint. I have to assume a bug.
Fortunately when I tried this endpoint, and searched for the serial number of a device it seemed to work. It returned several different assets for me that are marked as deleted.
just saw you got another call from Support that works. Awesome. Think I’ll steal that to save for later. Thanks!