Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello,
I want to monitor the application keys and their expiration date
I tried two ways to list the application keys:
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
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
Solved! Go to Solution.
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);
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);
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.