<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ThingWorx not returning POST JSON Swagger response in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/811561#M59113</link>
    <description>&lt;P&gt;As VladimirRosu&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;pointed out, missing necessary header might cause PostJson fail and return Header instead of Response.&lt;/P&gt;&lt;P&gt;Can you recheck the parameters?&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2022 08:41:27 GMT</pubDate>
    <dc:creator>wcui</dc:creator>
    <dc:date>2022-08-04T08:41:27Z</dc:date>
    <item>
      <title>ThingWorx not returning POST JSON Swagger response</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/811020#M59084</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am doing a postJson method in ThingWorx. But it is not returning the response body. When I execute the method in swagger, it is returning the response body but TW is returning just the headers. It is not returning like swagger but I wanted to read the response exactly like Swagger. How can we achieve this use case?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Swagger:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="svisveswaraiya_0-1659470036267.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/61573iD100A0B0BDDD1933/image-size/medium?v=v2&amp;amp;px=400" role="button" title="svisveswaraiya_0-1659470036267.png" alt="svisveswaraiya_0-1659470036267.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TW:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="svisveswaraiya_1-1659470179796.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/61574iFD6CBCC66FA0AFCD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="svisveswaraiya_1-1659470179796.png" alt="svisveswaraiya_1-1659470179796.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 20:15:19 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/811020#M59084</guid>
      <dc:creator>svisveswaraiya</dc:creator>
      <dc:date>2022-08-02T20:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: ThingWorx not returning POST JSON Swagger response</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/811040#M59085</link>
      <description>&lt;P&gt;What you see in the output is not the response headers, but the request header.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Which ThingWorx version is exhibiting this?&lt;/P&gt;
&lt;P&gt;2. Are you sure you're replicating the same POST request in ThingWorx? I see no password/username in the screenshot you supplied, but maybe you're passing an authorization token in the header? What about the request body, is it the same as the one you supplied via Swagger?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 21:50:19 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/811040#M59085</guid>
      <dc:creator>VladimirRosu</dc:creator>
      <dc:date>2022-08-02T21:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: ThingWorx not returning POST JSON Swagger response</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/811561#M59113</link>
      <description>&lt;P&gt;As VladimirRosu&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;pointed out, missing necessary header might cause PostJson fail and return Header instead of Response.&lt;/P&gt;&lt;P&gt;Can you recheck the parameters?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 08:41:27 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/811561#M59113</guid>
      <dc:creator>wcui</dc:creator>
      <dc:date>2022-08-04T08:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: ThingWorx not returning POST JSON Swagger response</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/812884#M59198</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/116627"&gt;@VladimirRosu&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;1, The TW version is&amp;nbsp;&lt;SPAN&gt;ThingWorx 9.1.0-b10877&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;2. Yes, I am replicating the same post request as Swagger but even if I pass the password and username it throws same error. It doesnt have any validation or authorization for the header.&lt;/P&gt;
&lt;P&gt;In swagger, it works fine for the same content but in TW, it doesnt work.&lt;/P&gt;
&lt;P&gt;I passed header as :&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;headers: { &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;'content-type: application/json'&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt; &lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;content = {&lt;BR /&gt;"plant": "string",&lt;BR /&gt;"transType": "string",&lt;BR /&gt;"user": "string",&lt;BR /&gt;"productionOrderNumber": "string",&lt;BR /&gt;"serialNumber": "string",&lt;BR /&gt;"componentTrackingDetails": [&lt;BR /&gt;{&lt;BR /&gt;"component": "string",&lt;BR /&gt;"serialNumber": "string"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;let params = {&lt;BR /&gt;proxyScheme: undefined /* STRING */,&lt;BR /&gt;headers: &lt;STRONG&gt;headers&lt;/STRONG&gt;/* JSON */,&lt;BR /&gt;ignoreSSLErrors: undefined /* BOOLEAN */,&lt;BR /&gt;useNTLM: undefined /* BOOLEAN */,&lt;BR /&gt;workstation: undefined /* STRING */,&lt;BR /&gt;useProxy: undefined /* BOOLEAN */,&lt;BR /&gt;withCookies: undefined /* BOOLEAN */,&lt;BR /&gt;proxyHost: undefined /* STRING */,&lt;BR /&gt;url: url /* STRING */,&lt;BR /&gt;content: content /* JSON */,&lt;BR /&gt;timeout: undefined /* NUMBER */,&lt;BR /&gt;proxyPort: undefined /* INTEGER */,&lt;BR /&gt;password: undefined /* STRING */,&lt;BR /&gt;domain: undefined /* STRING */,&lt;BR /&gt;username: undefined /* STRING */&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;var result = Resources["ContentLoaderFunctions"].PostJSON(params);&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 09:27:34 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/812884#M59198</guid>
      <dc:creator>svisveswaraiya</dc:creator>
      <dc:date>2022-08-12T09:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: ThingWorx not returning POST JSON Swagger response</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/812891#M59199</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/268900"&gt;@wcui&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;the headers are application/json, when I pass that it returns the headers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="svisveswaraiya_0-1660297609536.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/62267iE134B0522641880D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="svisveswaraiya_0-1660297609536.png" alt="svisveswaraiya_0-1660297609536.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 09:47:17 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/812891#M59199</guid>
      <dc:creator>svisveswaraiya</dc:creator>
      <dc:date>2022-08-12T09:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: ThingWorx not returning POST JSON Swagger response</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/815196#M59314</link>
      <description>&lt;P&gt;Below is sample code I tested PostJson on TW9.1.11.&lt;/P&gt;&lt;P&gt;I defined a thing “PostJsonTest” with a service "s1" which has a string parameter "p1".&lt;/P&gt;&lt;P&gt;As you can see, I manually set 5 parameters: header/url/content/username/password.&amp;nbsp;Note that parameter "p1" and its value is put inside content.&lt;/P&gt;&lt;P&gt;Can you refer to this sample then change and test your code&amp;nbsp;accordingly ?&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;let header = {&lt;BR /&gt;"Content-Type" : "application/json"&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;let content = {&lt;BR /&gt;"p1" : "aaa"&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;let params = {&lt;BR /&gt;proxyScheme: undefined /* STRING */,&lt;BR /&gt;&lt;STRONG&gt;headers: header /* JSON */,&lt;/STRONG&gt;&lt;BR /&gt;ignoreSSLErrors: undefined /* BOOLEAN */,&lt;BR /&gt;useNTLM: undefined /* BOOLEAN */,&lt;BR /&gt;workstation: undefined /* STRING */,&lt;BR /&gt;useProxy: undefined /* BOOLEAN */,&lt;BR /&gt;withCookies: undefined /* BOOLEAN */,&lt;BR /&gt;proxyHost: undefined /* STRING */,&lt;BR /&gt;&lt;STRONG&gt;url: "&lt;A href="http://xxx/Thingworx/Things/PostJsonTest/Services/s1" target="_blank"&gt;http://xxx/Thingworx/Things/PostJsonTest/Services/s1&lt;/A&gt;" /* STRING */,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;content: content /* JSON */,&lt;/STRONG&gt;&lt;BR /&gt;timeout: undefined /* NUMBER */,&lt;BR /&gt;proxyPort: undefined /* INTEGER */,&lt;BR /&gt;&lt;STRONG&gt;password: "xxx" /* STRING */,&lt;/STRONG&gt;&lt;BR /&gt;domain: undefined /* STRING */,&lt;BR /&gt;&lt;STRONG&gt;username: "xxx" /* STRING */&lt;/STRONG&gt;&lt;BR /&gt;};&lt;BR /&gt;// result: JSON&lt;BR /&gt;let result = Resources["ContentLoaderFunctions"].PostJSON(params);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 07:48:34 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/ThingWorx-not-returning-POST-JSON-Swagger-response/m-p/815196#M59314</guid>
      <dc:creator>wcui</dc:creator>
      <dc:date>2022-08-25T07:48:34Z</dc:date>
    </item>
  </channel>
</rss>

