description: undefined /* STRING /,</p><p class="MsoNormal"><span class="Apple-tab-span" style="white-space:pre"> </span>name: user / STRING */,
Hi Saurabh,
Thanks Adam..
Do you have a off the shelf code available for the same which I can use. It would be helpful..
Thanks
Saurabh
Hi Adam
I tried to recreate what you said and here is my code snippet. But I am getting the exception.
var params = {
description: undefined /* STRING /,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>name: usler / STRING /,</div><div> user: UserName / USERNAME /,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>whitelist:"abc" / STRING */
};
Resources["EntityServices"].CreateApplicationKey(params);
me.EnableThing();
me.RestartThing();
I am still getting the following exception and the url doesnt understand the App key
00:35:44 ERROR - Error in invoking service Things_AppKeyThing, generateAppKeyForUser, Things, AppKeyThing, Services, generateAppKeyForUser. Error from the server: "Wrapped com.thingworx.common.exceptions.InvalidRequestException: ApplicationKey already exists Cause: ApplicationKey already exists"
</span></div></p>
Saurabh,
It's likely you have a "ghost" testerror
Thing
and you will need to restart Tomcat to remove it. In yourService
, you'll want to wrap everything that could throw an exception in a try-catch block. For example:try {
// Create Application Key
}
catch (err) {
logger.error("Oh no!");
// Remove Application Key in Memory (if necessary)
}