6 Replies Latest reply on Jan 11, 2017 10:19 AM by ttielebein RSS
    pgupta-2 Apprentice

    Application Key

    I am seeing weird behavior for the GetKeyID method. It appears that it is a bug. Can someone please confirm this?

     

    myKey = ApplicationKeys[currentUser].GetKeyID();

     

    The currentUser is part of Administrator group. When I execute the service it returns me the App Key. When I look at System -> Application Keys, I do not see the App Key created.

     

    Thanks,

    Preeti

      • Re: Application Key
        carlesc Ninja

        You can't create an app key that way, you should use:

         

        var params = {

          name: "ApplicationKeyName" /* STRING */,

          description: undefined /* STRING */,

          whitelist: undefined /* STRING */,

          user: "UserNameAssignedToThisAppKey" /* USERNAME */,

          tags: undefined /* TAGS */

        };

         

         

        // no return

        Resources["EntityServices"].CreateApplicationKey(params);

          • Re: Application Key
            pgupta-2 Apprentice

            Hi Carles,

            Thanks for responding. Yes I am using that to create an app key. But the funny thing is I don't see the App Key created in the UI. However when I use GetKeyID, it is returning me a valid key. It looks like it's reference is still in the database.

             

            Preeti

            • Re: Application Key
              tayyasamy Explorer

              Hi,

               

              I need one help.

               

              How to get Create Application Key and GetKeyID in Thingworx Java.

              I used code like,

               

              For Creating Application Key,

              EntityServices es = new EntityServices();

              es.createApplicationKey()

               

              For Getting Key ID,

               

              ApplicationKey ak = (ApplicationKey) EntityUtilities.findEntity(userName, ThingworxRelationshipTypes.ApplicationKey);

              ak.GetKeyID();

               

              But both are not working. Please help me.

            • Re: Application Key
              carlesc Ninja

              Hi,

               

              It maybe a trasactional / Ghost entity problem, if the script which creates the AppKey throws an unhandled exception you can be on the situation you are now. Restart tomcat and check if still you get an AppKey with GetKeyID.

               

              Carles.