Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi,
We need to integrate ThingWorx with a company web application.
The application receive json as an input than it returning response with a base64 content inside the body.
Using postman for testing we can see the body in the response.
Our issue is we could not find a way to see the body in the response using ThingWorx service using ContentLoaderFunctions services like PostJSON.
Anyone know how can we read the body response of a post request using ThingWorx?
BR,
Tomer.
Solved! Go to Solution.
Hi @Velkumar ,
I am adding 2 images.
first is a postman post request, you can see the pdf in the body.
the second is a ThingWorx request where the body is missing.
EDIT:
So found the reason for the missing body.
The PostJSON return only JSON response,
When I used PostBinary it return the pdf output but this way I cannot post my JSON.
I do not understand the limitation that the output need to be as the input but at least now i know the issue.
After changing the application response to JSON it did solve the problem.
Best Regards,
Tomer.
Hi @TomerH
I've tried with a sample POST JSON API and it is working fine. I'm able to read response from server
More Information - How to consume Rest API in Thingworx #thingworx #restapi #iiot #internetofthings - YouTube
Could you please tell me your Thingworx version and how you are trying to implement it?
/VR
Hi @Velkumar,
Thank you for the reply.
Lets say the web application returning a binary base64 content similar to my txt attachment and content type is application/pdf
In my system we can also see the reply result.
As you see also at the image you provided there are responseHeaders and responseStatus.
But how can I read the content or the responseBody?
If needed, I Will add more images tomorrow to give more context to my question.
Best Regards,
Tomer.
Hi @TomerH
In my example API, the token value is the response from the server side.
Here is the best example with multiple key values :
API Link - Reqres - A hosted REST-API ready to respond to your AJAX requests
Please add images that will help us to understand better.
/VR
Hi @Velkumar ,
I am adding 2 images.
first is a postman post request, you can see the pdf in the body.
the second is a ThingWorx request where the body is missing.
EDIT:
So found the reason for the missing body.
The PostJSON return only JSON response,
When I used PostBinary it return the pdf output but this way I cannot post my JSON.
I do not understand the limitation that the output need to be as the input but at least now i know the issue.
After changing the application response to JSON it did solve the problem.
Best Regards,
Tomer.