Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hello everyone,
I am using Value stream on ThingWorx Server and sending PUT requests (using REST API) setting the properties values and eventually visualizing the changes using mashups.
This feature works well when I change the properties value manually from the ThingWorx server, as it is mentioned in this training. However, when I send the PUT requests using Postman client or Python scripts with REST API, the properties values get updated successfully but the value changes can not be seen with the QueryPropertyHistory Service. It should be also noted that for sending the PUT request with Postman and Python scripts, I should send the request multiple times. In the first efforts I get the error message "500 Internal Server Error" before the request sent successfully getting the message "200 OK". Please refer to the attachments for python script and a screenshot from Postman client.
Just before sending this post, I used the suggested Restlet Client sending PUT request and I noticed that not only the value changes can be seen in the QueryPropertyHistory Service table, but also after the first attempt the request sent with message "200 OK", without any "500 Internal Server Error". Then, I tried again to send the request by Postman client and the Python scripts and now I only receive the "500 Internal Server Error" message. I also compared the headers in the Reslet and the other clients but I didn't see any differences. A screenshot from the Restlet Client request can be seen in the attachments.
I would be grateful if anyone could help me on this issue.
Are you at all running into a permission problem? What permissions does the account have that you are using with your rest call?
If it isn't admin, one common issue is that visibility wasn't granted to the 'Persistence Provider'
Also what errors if any are listed in the application log?
I am not sure if the problem is from the Permission. Actually, I have granted the visibility permission to "Everyone". I also tried with granting different visibility permissions, but didn't help.
Another point that might be interesting for you: When I send the put request for changing values of two properties, the value of only one of the properties changes and the Error 500 is received. However, that change cannot be seen in the QueryPropertyHistory as well.
What messages do you see in the Application log?
Simply just an Error without any description in the content, as it can be seen in the following screenshot.
Application Log
If you were to use an appkey that is tied to the Administrator user, do you still get this error?
Thank you for the support. I just created a new application key and assigned it to the Administrator and the problem is solved!
However, according to the PTC tips assigning an application key to a user in the Administration group is not the best practice. Would there be a solution for that?
Correct, using Administrator is just a troubleshooting tool to make sure there aren't any additional issues.
You basically have a permissions issue.
1. Make sure the Appkey user you created can execute the Property Write or if you are calling a service, make sure it can execute the service
2. next make sure System user is applied to everything for runtime service execute (i've posted a script in regards to this somewhere)
3. Make sure that the User has visibility to the entity writing to, the stream logged to and the Persistence Provider of the stream.
If you are using the Everyone Org, verify that Users is assigned to the Everyone Org and then make sure that the Everyone Org is assigned to Visibility for each of these entities or the collections.
Just adding Users back to Everyone, doesn't open up visibility to everything.
As you suggested, I again checked the Permissions settings for different users. The Run Time Permissions already had been granted for Property, Read, Write, Service and Event Execute and Event Subscribe. Also the Visibility was simply set to Everyone. Please see the attached screenshots of the Permission settings for different users and things.
In my honest opinion, I don't think that it would be a Permission issue. If it was so, it wouldn't work with Restlet Client as well, but Value Streaming and updating the Properties values using Restlet Client work perfectly. However, doing exact things with other clients like Postman or Python scripts doesn't work.