5 Replies Latest reply on Apr 11, 2017 3:05 AM by anna RSS
    avaidya Newbie

    Accessing Thing's Service as REST API

    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&#x3a; Thing com.thingworx.things.ConfiguredThing&#x40;4dbad8d7 &#x3a; 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>&#x7b;&quot;answer&quot;&#x3a;182.0&#x7d;</TD></TR></TABLE></BODY></HTML>