Skip to main content
1-Visitor
July 7, 2017
Solved

How to search Things by name?

  • July 7, 2017
  • 1 reply
  • 5663 views

I have several Things named "thing1", "thing2", "thing3", "thing4", etc, which I want to delete. I am thinking of a way to first 'Find' or 'Query' or 'Search' the Things that begins with "thing" and then 'Delete' them. Nevertheless, I do not know which service to use to 'Find' or 'Query' or 'Search' Things.


Anybody knows what service do I need? Or is there any better solution to my intention?


thanks

Best answer by supandey

You can try this, i think this fits your requirement more

var params = {

  maxItems: 500 /* NUMBER */,

  nameMask: "<provide entity name here>" /* STRING */,

  type: 'Thing' /* STRING */,

  tags: undefined /* TAGS */

};

// result: INFOTABLE dataShape: RootEntityList

var result = Resources["EntityServices"].GetEntityList(params);

Note that you can use the Type to seach for different entities like Things, Mashups, Users etc

You can find this together with other EntityServices under the Snippets > EntityServices

1 reply

5-Regular Member
July 7, 2017

Hi Samuel, you can consider using one of the following search functions available directly under the ThingWorx Composer > System > Resources > SearchFunctions

Hope this helps.

syu11-VisitorAuthor
1-Visitor
July 7, 2017

Hi Sushant, thank you for your reply! Could you, please, be more specific about what Inputs I should enter in order to search the Things I need? I took a look at the Inputs of these three services but just couldn't find 'names' in them. Does that mean I can't search things by name? Or are there other ways to try?

supandey5-Regular MemberAnswer
5-Regular Member
July 7, 2017

You can try this, i think this fits your requirement more

var params = {

  maxItems: 500 /* NUMBER */,

  nameMask: "<provide entity name here>" /* STRING */,

  type: 'Thing' /* STRING */,

  tags: undefined /* TAGS */

};

// result: INFOTABLE dataShape: RootEntityList

var result = Resources["EntityServices"].GetEntityList(params);

Note that you can use the Type to seach for different entities like Things, Mashups, Users etc

You can find this together with other EntityServices under the Snippets > EntityServices