cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

List Of Application Keys and their expiration date

FredDL
10-Marble

List Of Application Keys and their expiration date

Hello,

 

I want to monitor the application keys and their expiration date

 

I tried two ways to list the application keys:

 

  • using GetEntityList() from EntityService

 var result = Resources["EntityServices"].GetEntityList({

  maxItems: 10000,

  nameMask: undefined,

  type: 'ApplicationKey',

});

 

But this give me an infotable with the following fields:

avatar, description, homeMashup, isSystemObject, name, tags

 

  • Then I tried SpotLightSearch:

const result = Resources["SearchFunctions"].SpotlightSearch({
maxItems: 1000000,
types: { items: [
"ApplicationKey"
]},
aspects: { isSystemObject: false },
maxSearchItems: 1000000
});

This give me an infotable wtih the following fields:

 delete, description, id, isEditable, isEditableExtensionObject, isEditableSystemObject, isExtension, isSystemObject, lastModifiedDate, name, parentName, parentType, read, type, update

 

So my problem is that both returned infotable that are not matching the ApplicationKey DataShape. 

And those infotable lack the userNameReference  field which could allow me to get the  ApplicationKeyExpirationInfoCollection (using GetApplicationKeyExpirationInfo

https://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/index.html#page/ThingWorx/Help/Composer/Security/ApplicationKeys/ApplicationKeyServices.html ) where I could have the reference user and expiration date.

 

How can I get a list of application key with their expiration date?

Thanks

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:FredDL)

I think the second one provides 'name' from there can't you use ApplicationKeys[name].GetExpirationDate() ?

 

Beyond that here is another search function:

var params = {
maxItems: undefined /* NUMBER */,
searchExpression: "**" /* STRING */,
types:  { items: ["ApplicationKey"]} /* JSON */,
aspects: undefined /* JSON */,
excludedAspects: undefined /* JSON */,
maxSearchItems: undefined /* NUMBER */,
tags: undefined /* TAGS */
};

// result: INFOTABLE dataShape: EntityDescriptor
var result = Resources["SearchFunctions"].SearchModelEntities(params);

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:FredDL)

I think the second one provides 'name' from there can't you use ApplicationKeys[name].GetExpirationDate() ?

 

Beyond that here is another search function:

var params = {
maxItems: undefined /* NUMBER */,
searchExpression: "**" /* STRING */,
types:  { items: ["ApplicationKey"]} /* JSON */,
aspects: undefined /* JSON */,
excludedAspects: undefined /* JSON */,
maxSearchItems: undefined /* NUMBER */,
tags: undefined /* TAGS */
};

// result: INFOTABLE dataShape: EntityDescriptor
var result = Resources["SearchFunctions"].SearchModelEntities(params);

FredDL
10-Marble
(To:PaiChung)

Thank you.

I thought that the search for the Applications Keys would return data with the Application Keys DataShape and not EntityDescripto (or else) but this seems logic afterwards

ApplicationKeys[name].GetExpirationDate() returns the expiration date that I need. So I will start from there!

 

Thanks.  Solved my issue as well.

 

Announcements


Top Tags