Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I am making an REST call from a service back to the ThingWorx platform that is running the service. The purpose of this service it to programmatically create a subscription (I am aware of the Dynamic Subscription services, but they do not work for my use case). If I make the REST call from the subscription everything works, but the response I get from the REST call doesn't tell me anything. This isn't really useful in the case there is an error.
How can I get the same response in my script that the Application Log and POSTMAN are getting (see below)?
Example (names cleared out):
Response from service test:
However, there was an error logged in the Application Log:
When I make the REST call from POSTMAN, it returns the same message as the Application Log:
Here is the script and the message that is logged in the Script Log:
Initial thought might be extend you wrapper service to combine the add and a check that the subscription is added correctly.
I have not looked into the details
Steve - I took your advice and handled this in the wrapper service by making the same REST call that I originally make to get the Thing data shape JSON. This allows me to verify that the subscription was added, but if something does fail, I don't know what.
On another note, we are having the same issue when making REST calls to a BarTender print service. The call is working and the labels are printing the but the content of the response is just "{"headers":""}". The response in BarTendder has much more data. We'd like to have this response available in the service so we can display on a mashup why a print job failed. Any ideas why this works in Postman, but not in ThingWorx?
TW Response and javascript:
Postman Response: