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
Hi,
Done basic TW tutorial.
I have written MyThing.myService() that returns JSONObject.
return type=JSON
var ans=op1 * op2;
var Jres = {"answer":ans};
result = Jres;
external clients is only expecting JSON details (highlighted), but the HTTP response contains ThingworxLogo.png and few <TR> <TD> tags as below
how to get rid of these non-JSON data in HTTP response
Regards,
Aniruddha
<HTML><HEAD><TITLE>ThingWorx: Thing com.thingworx.things.ConfiguredThing@4dbad8d7 : Response From Execution Of multiply</TITLE><LINK rel='Stylesheet' href='/Thingworx/css/thingworxapi.css' type='text/css'></LINK><META http-equiv='Content-Type' content='text/html'></META><META http-equiv='cache-control' content='no-cache, no-store'></META><META http-equiv='expires' content='-1'></META><META http-equiv='pragma' content='no-cache, no-store'></META></HEAD><BODY><IMG SRC="/Thingworx/images/ThingworxLogo.png"/><BR/><H1>multiply</H1><TABLE><TR><TH>result</TH></TR><TR><TD>{"answer":182.0}</TD></TR></TABLE></BODY></HTML>
Solved! Go to Solution.
Hi Aniruddha,
Not very sure about your Rest API request, htere is my sample:
API URL: http://127.0.0.1:8080/Thingworx/Things/Thing2/Services/Service1?method=POST&appKey=87f90394-9d5b-49fb-99f3-ad7661b2429d<Change to your key>&Content-Type=application/json
PostMan
Wish you a nice weekend.
Hi Aniruddha,
Not very sure about your Rest API request, htere is my sample:
API URL: http://127.0.0.1:8080/Thingworx/Things/Thing2/Services/Service1?method=POST&appKey=87f90394-9d5b-49fb-99f3-ad7661b2429d<Change to your key>&Content-Type=application/json
PostMan
Wish you a nice weekend.
Thanks for the reply
Hi Aniruddha,
Just let me know if the solution not work for you.
Lily
Hi Lily,
It worked for me, Thanks
Hi Vaidya,
If the answer is helpful or your issue is resolved, please mark correct answer to Li Li Liu or Mark it Helpful so we will close this topic.
Thanks,
Br,
Anna