List Of Application Keys and their expiration date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Solved! Go to Solution.
- Labels:
-
Coding
-
Mashup-Widget
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks. Solved my issue as well.
