Skip to main content
5-Regular Member
March 30, 2017
Solved

How to delete Things with a specific tag from REST Api

  • March 30, 2017
  • 1 reply
  • 1552 views

My question is in the title !

I've been using REST Api in order to delete a specific entity, but I need to delete a group of things with the same tag, so how could I do that?

Thanks in advance!

    Best answer by AdamR

    Hi Elie,

    The best way to do this is to create a custom service that you call from the REST Api and pass in the value of the tag (this can be a string value in the rest call).  You can convert this to a tag in the service, then search for things with that tag using the SearchThings service in the SearchFunctions resource.  Loop through the resulting infotable and delete the things.

    Adam

    1 reply

    AdamR14-AlexandriteAnswer
    14-Alexandrite
    March 30, 2017

    Hi Elie,

    The best way to do this is to create a custom service that you call from the REST Api and pass in the value of the tag (this can be a string value in the rest call).  You can convert this to a tag in the service, then search for things with that tag using the SearchThings service in the SearchFunctions resource.  Loop through the resulting infotable and delete the things.

    Adam

    emadar5-Regular MemberAuthor
    5-Regular Member
    April 2, 2017

    That is actually a really good idea! I'm not sure that this was what I was looking for but it should really help me anyways.

    Thank you!