Skip to main content
Nov 28, 2024 2:01 PM UTC
Solved

is it possible to iterate on all Application keys in thingworx without knowing id

Hi community,

 I would like to ask that if anyone knows that how to iterate over the application keys which are existed in the platform without knowing anything like list of Application keys. Please let me know about it

for eg like GetKeyID(), GetExpirationDate(), ...

 

Thanks!

MA8731174Answer
Nov 29, 2024 8:25 AM UTC

thank you! i also found out one solution

 

var params = {
tag: undefined ,
nameMask: undefined ,
type: "ApplicationKey" ,
maxItems: 500 
};


var result = Resources["EntityServices"].GetEntityList(params); 
//select output as an infotable

5 replies

Nov 28, 2024 2:33 PM UTC

Here you go:

 

Resources["SearchFunctions"].SearchModelEntities({ 
 types: {"items": ["ApplicationKey"]} 
}).rows.toArray().map(row => row.name).forEach(key => {
 let entity = ApplicationKeys[key];
 logger.debug('AppKey ' + key + ': ' + entity.GetKeyID() + ', expiring on ' + entity.GetExpirationDate());
});

 

/ Constantine

MA8731174AuthorAnswer
Nov 29, 2024 8:25 AM UTC

thank you! i also found out one solution

 

var params = {
tag: undefined ,
nameMask: undefined ,
type: "ApplicationKey" ,
maxItems: 500 
};


var result = Resources["EntityServices"].GetEntityList(params); 
//select output as an infotable

2-Explorer
Dec 9, 2024 1:34 PM UTC

Hi @MA8731174 ,

I wanted to follow up with you on your post. Upon further review, we have gone ahead and designated the post we feel successfully answered your question.

In the event that you disagree with the Solution Accepted, please let me know.

Thanks for using the PTC Community! 

Regards,
Abhi