8 Replies Latest reply on Sep 22, 2017 1:00 AM by saeedma RSS
    jbester Explorer

    REST API property value update do not fire value change event

    Good day,

     

    I am updating a property value on a thing using the REST API. The property value is successfully updated on the Thing (the value changes when viewed under properties), but no value change event is picked up to be logged to a value stream or fire a subscription on value change.

     

    In the Application logs, the following error message is showed: [context: com.thingworx.webservices.context.HttpExecutionContext@301db274].

     

    Any suggestions as to what possibly the problem is?

     

    Thank you

      • Re: REST API property value update do not fire value change event
        ytella Apprentice

        Hi Johan Bester, Could you please confirm the way you have followed to create an event for the thing ?

        Did you create a custom event on the thing as shown below?

        or Defined the events at the thing, thing template or thing shape level?

        • Re: REST API property value update do not fire value change event
          jbester Explorer

          Update:

           

          It seems to be a permission error. It works fine if I change the Application Key I use to have Administrative access instead of limited access to only change the one thing.

           

          I assume there are some visibility permissions I have to set on one of the subsystems or resources to get it to function properly.

           

          Does anybody have any idea which one it is? I have tried:

               - Platform subsystem

               - Logging subsystem    

               - ValueStreamProcessingSubsystem

           

          to no avail.

           

          Thank you

            • Re: REST API property value update do not fire value change event
              polinao Ninja

              Do you have property update permissions on the thing? Visibility on the thing and its template too.

                • Re: REST API property value update do not fire value change event
                  jbester Explorer

                  Hi Polina,

                   

                  I do have the visibility, design time as well as runtime permissions set up on the thing instance, not on the Generic template thing template it is derived from, but I do not think it is necessary because it is one instantiation of the specific thing I am working with. (To make sure it is not the issue I just gave all of the visibility and design time and run time permissions to specific user on all of the templates and things and it did not make a difference).

                   

                  Without the proper permissions on the thing I do not think the property can be updated from the REST API which it is doing. It just do not pick up a value change to write it to the value stream or fire a subscription on data change.

                   

                  I have set the visibility and permissions on the subsystems and the resources to include the specific limited rights user that the application key use, still getting the same error message with no event triggered. So it doesn's even look like the issue is there.

                   

                  I am out of other possible ideas for the moment, do you perhaps have some? I do not think it is an option to give the remote device reporting the data Administrative privileges.

                   

                  (just a quick description of my setup: at the moment I have a test Thing set up inheriting from the GenericThing template, I have a value stream assigned to the thing and all the relevant visibilities and permissions for runtime and design time set. I have two properties (a test value being changed (logged) via PUT request and a boolean property changing with a subscription on data change of the test property). The value for test property is updated with the API and I can see the value change, but subscription is not fired and the logged test property is not logged to value stream when the application key has reduced permissions, but when the application key has Administrative privileges it works without an issue)

                   

                  Your help is appreciated.

              • Re: REST API property value update do not fire value change event
                saeedma Apprentice

                Hi Johan,


                I assume the error message you posted is from the Application log, but if you are observing the data change issue by checking the execution of a subscription, you should see more information in the script log each time a subscription script execution is attempted. Can you send a copy of the script log as well as a screen shot of the runtime permissions of the Thing entity?

                • Re: REST API property value update do not fire value change event
                  saeedma Apprentice

                  It seems like the data change event is not firing because the user does not have permission to add the logged properties to the value stream. With stack tracing enabled in the logging subsystem, you will see an error like this.

                   

                  com.thingworx.webservices.context.HttpExecutionContext@5fc32268] java.lang.NullPointerException: null

                      at com.thingworx.persistence.common.ValueStreamEngine.getValueStreamEntryProcessor

                   

                  This can be corrected by adding the organization that your user belongs to to the visibility permissions of the Thingworx persistence provider. To update this, from the persistence provider list, select "advanced" and check "Show System Objects" to display the ThingWorxPersistenceProvider. Add your organization in the visibility section and save.