Solved

API Endpoint /assets/deleted returns error 404

  • 27 March 2023
  • 6 replies
  • 47 views

Userlevel 2
Badge

Hello!

 

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? 

 

Thanks! 

icon

Best answer by curtis.bohlmeyer 25 May 2023, 15:43

View original

6 replies

Userlevel 7
Badge +12

@bclark @Cozmo03 @SFowler 47089e7 forsyth Any work around ideas for this? We all know I am no API expert 😄

Userlevel 2
Badge

Hey Kathryn! 

 

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'
--data '{"OnlyShowDeleted":true,"Filters":[],"FilterByViewPermission":true}'

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!

Userlevel 7
Badge +12

@CBohlmeyer 710df2e lps53 Glad support could help you! Anything API I would direct to them, our community team are not the experts on APIs 🤣

Userlevel 5
Badge +10

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.

GET /assets/serial/search/{Serial}

 

Userlevel 5
Badge +10

just saw you got another call from Support that works. Awesome. Think I’ll steal that to save for later. Thanks! 

Userlevel 7
Badge +12

@bclark I knew this thread needed you on it! 

Reply