<?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: Status Code 415 in Webex for Developers</title>
    <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5020992#M2799</link>
    <description>&lt;P&gt;I did point it to Apiary API mock server, and then it came back as OK. When I changed it to the actual GC device, it got error 415.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Feb 2024 06:47:51 GMT</pubDate>
    <dc:creator>gmathilassi</dc:creator>
    <dc:date>2024-02-20T06:47:51Z</dc:date>
    <item>
      <title>Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731384#M1713</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;
&lt;P&gt;I`m trying to control a Global Cache Flex relay unit, via PUT command. I have used Insomnia to control the device, and it works fine from there. When I use Cisco to control this, I get an error back from the device. It looks like this:&lt;/P&gt;
&lt;P&gt;16:23:35 [system] Using XAPI transport: WebSocket&lt;BR /&gt;16:23:35 [system] Starting macros...&lt;BR /&gt;16:23:35 GCTest Loading...&lt;BR /&gt;16:23:35 GCTest 'Script started'&lt;BR /&gt;16:23:35 GCTest 'Init started'&lt;BR /&gt;16:23:35 GCTest Ready!&lt;BR /&gt;16:23:40 GCTest 'GC1 Command_ON'&lt;BR /&gt;16:23:40 GCTest 'GC1 Command_SENT'&lt;BR /&gt;16:23:40 GCTest { code: 1,&lt;BR /&gt;data: &lt;BR /&gt;{ Headers: &lt;BR /&gt;[ { Key: 'Cache-Control', Value: 'max-age=600', id: '1' },&lt;BR /&gt;{ Key: 'Connection', Value: 'close', id: '2' },&lt;BR /&gt;{ Key: 'Content-Type', Value: 'application/json', id: '3' } ],&lt;BR /&gt;StatusCode: '415' },&lt;BR /&gt;message: 'Command returned an error.' }&lt;/P&gt;
&lt;P&gt;I have also sent the commands in to a local webserver, in order to see what is sent from Cisco and from Insomnia.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From Cisco:&lt;BR /&gt;Listening on port 80...&lt;BR /&gt;Received request for &lt;A href="http://10.10.70.222/api/host/modules/1/relays/logicals/1" target="_blank" rel="noopener"&gt;http://10.10.70.222/api/host/modules/1/relays/logicals/1&lt;/A&gt;&lt;BR /&gt;1---------------------&lt;BR /&gt;Content-Length, 38&lt;BR /&gt;Content-Type, application/json&lt;BR /&gt;Accept, */*&lt;BR /&gt;Accept-Charset, ISO-8859-1,utf-8&lt;BR /&gt;Host, 10.10.70.222&lt;BR /&gt;User-Agent, Cisco/CE&lt;BR /&gt;2---------------------&lt;BR /&gt;Content-Length&lt;BR /&gt;Content-Type&lt;BR /&gt;Accept&lt;BR /&gt;Accept-Charset&lt;BR /&gt;Host&lt;BR /&gt;User-Agent&lt;BR /&gt;3---------------------&lt;BR /&gt;{&lt;BR /&gt;"type": "SPST",&lt;BR /&gt;"state": "off"&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From Insomnia&lt;/P&gt;
&lt;P&gt;Listening on port 80...&lt;BR /&gt;Received request for &lt;A href="http://localhost/api/host/modules/1/relays/logicals/1" target="_blank" rel="noopener"&gt;http://localhost/api/host/modules/1/relays/logicals/1&lt;/A&gt;&lt;BR /&gt;1---------------------&lt;BR /&gt;Content-Length, 42&lt;BR /&gt;Content-Type, application/json&lt;BR /&gt;Accept, */*&lt;BR /&gt;Host, localhost&lt;BR /&gt;User-Agent, insomnia/2022.6.0&lt;BR /&gt;2---------------------&lt;BR /&gt;Content-Length&lt;BR /&gt;Content-Type&lt;BR /&gt;Accept&lt;BR /&gt;Host&lt;BR /&gt;User-Agent&lt;BR /&gt;3---------------------&lt;BR /&gt;{&lt;BR /&gt;"type": "SPST",&lt;BR /&gt;"state": "off"&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They seems to be the same, but Cisco is also sending "Accept-Charset, ISO-8859-1,utf-8", while Insomnia is not. Is Cisco doing this automaticly? Or are there any way of stopping Cisco from sending this?&lt;/P&gt;
&lt;P&gt;My code in Cisco:&lt;BR /&gt;const xapi = require('xapi');&lt;BR /&gt;console.log('Script started');&lt;BR /&gt;const GC_address = '10.10.70.140'; /* IP of GC flex. */&lt;BR /&gt;const HTTP_TIMEOUT = 1; /* How fast (in seconds) the HTTP get commands should fail with timeout error. */&lt;BR /&gt;const OutletMode = 4;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;function GC1_On() {&lt;BR /&gt;var body = {&lt;BR /&gt;'type': 'SPST',&lt;BR /&gt;'state': 'off'&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;var header = {&lt;BR /&gt;'Accept': 'application/json',&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'Content-Length': 50&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;console.log('GC1 Command_ON');&lt;BR /&gt;var url = 'http://' + GC_address + '/api/host/modules/1/relays/logicals/1';&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;xapi.command('HttpClient Put', {&lt;BR /&gt;AllowInsecureHTTPS: true,&lt;BR /&gt;Url: url,&lt;BR /&gt;Header: ['Content-Type: application/json', "Accept: */*",] &lt;BR /&gt;},&lt;BR /&gt;JSON.stringify(body, undefined, 2)&lt;BR /&gt;&lt;BR /&gt;).then((result) =&amp;gt; {console.log(result.body)}).catch(e =&amp;gt; console.log(e));&lt;/P&gt;
&lt;P&gt;console.log('GC1 Command_SENT');&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;function onUiAction(event) &lt;BR /&gt;{&lt;BR /&gt;if (event.WidgetId === 'BlindClose' &amp;amp;&amp;amp; event.Type === 'pressed')&lt;BR /&gt;{&lt;BR /&gt;GC1_On();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;function init()&lt;BR /&gt;{&lt;BR /&gt;console.log('Init started');&lt;BR /&gt;xapi.config.set('HttpClient Mode', 'On'); //this needs to be set to on to allow HTTP Get&lt;BR /&gt;/* Event listeners for manual light controls from the touch 10 panel */&lt;BR /&gt;xapi.Event.UserInterface.Extensions.Widget.Action.on(onUiAction);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;init();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 08:34:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731384#M1713</guid>
      <dc:creator>gmathilassi</dc:creator>
      <dc:date>2022-12-02T08:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731652#M1718</link>
      <description>&lt;P&gt;Testing your code, it seems the device (in my case a Webex registered Room Kit Plus) automatically adds the "accept-charset ISO-8859-1,utf-8 " header; further, it does not seem possible to override this by specifying something else in the HttpClient Put Header (e.g. 'accept-charset: *').&lt;BR /&gt;Accept-Charset is '&lt;A href="https://datatracker.ietf.org/doc/html/rfc9110#section-12.5.2" target="_self"&gt;deprecated&lt;/A&gt;', however it is a valid header, and the value/charsets are valid.&amp;nbsp; It would be good if the device omitted this header entirely, however it's arguable that the GC API should handle this header gracefully (e.g. by ignoring it, or passing it for 'utf-8'.)&lt;BR /&gt;Assuming modifying the behaviour of the Cisco and/or GC device is the only fix, possibly the only workaround I can think of would be to establish a proxy server that strips the Accept-Charset header before forwarding it on.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 17:44:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731652#M1718</guid>
      <dc:creator>dstaudt</dc:creator>
      <dc:date>2022-12-02T17:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731666#M1719</link>
      <description>Hello.&lt;BR /&gt;&lt;BR /&gt;We have added this into Insomnia, and the GC is working there with accept-charset.&lt;BR /&gt;We have concluded that this doesn't make any issues.&lt;BR /&gt;I forgot to attach the link for GC Flex API.&lt;BR /&gt;&lt;A href="https://gcapi.docs.apiary.io/#reference/relay-outputs/modify-type-or-state-attributes-of-a-logical-relay?console=1" target="_blank"&gt;https://gcapi.docs.apiary.io/#reference/relay-outputs/modify-type-or-state-attributes-of-a-logical-relay?console=1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;We are using the relay module, and I just want to open and close the relay.&lt;BR /&gt;I have also tried to send this command via SSH on the codec:&lt;BR /&gt;xCommand HttpClient Get Url: &lt;A href="http://10.10.70.140/api/host/modules/1/relays/logicals" target="_blank"&gt;http://10.10.70.140/api/host/modules/1/relays/logicals&lt;/A&gt;&lt;BR /&gt;However, this command successfully went through.&lt;BR /&gt;When I sent this, it came back with the same error message 415&lt;BR /&gt;xCommand HttpClient Put Header: "Content-Type: application/json" Url: &lt;A href="http://10.10.70.140/api/host/modules/1/relays/logicals/1" target="_blank"&gt;http://10.10.70.140/api/host/modules/1/relays/logicals/1&lt;/A&gt;&lt;BR /&gt;{type:SPST,state:off}&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;I have no idea where to go from here.&lt;BR /&gt;&lt;BR /&gt;Regards Glenn Mathilassi&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Dec 2022 18:12:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731666#M1719</guid>
      <dc:creator>gmathilassi</dc:creator>
      <dc:date>2022-12-02T18:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731687#M1720</link>
      <description>&lt;P&gt;Can you reproduce the problem by pointing your macro at the Apiary API's mock server, or only with the actual GC device?&amp;nbsp; Can you reproduce the problem with Postman or any other tool?&lt;BR /&gt;If all else fails, it would be helpful to compare network packet captures for requests from Cisco/Insomnia/(Postman)-&amp;gt;GC&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 19:04:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731687#M1720</guid>
      <dc:creator>dstaudt</dc:creator>
      <dc:date>2022-12-02T19:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731885#M1722</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;
&lt;P&gt;I have tried to use Apiary API Mock server, and the commands came bak as OK. I look at the info both from my codec, and from Insomnia, and they was all the same.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when i try the same command on the real device, it comes back with error 415. I think i have to send an e-mail to Global Cache to raise a case at this thing.&lt;/P&gt;
&lt;P&gt;If you want, you can have a look at the&amp;nbsp; results from APIary.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2022 13:30:43 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/4731885#M1722</guid>
      <dc:creator>gmathilassi</dc:creator>
      <dc:date>2022-12-03T13:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5019575#M2797</link>
      <description>&lt;P&gt;I have met now the same problem with same error. Amazing that this 415 error is so rare Cisco and iTach came here on one or two search result. After beating this up for some hours I believe that Cisco is blocking the "application/json" put action. Codec seems to destroy or ignore the header desire to use json and sends it as the wrong form, maybe only text. Attach to screenshot of wireshark capture. see that one from postman is recognized as HTTP/JSON while one from codec is only HTTP.&lt;/P&gt;&lt;P&gt;Postman to iTach:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="postman to itach.png" style="width: 400px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/210447i3F7A33AF5ED9FE01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="postman to itach.png" alt="postman to itach.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;And codec to a webserver (was unable to snoop the wire of codec to iTach so had to send the post to laptop webeserver. same laptop with postman.)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="codec to webserver.png" style="width: 400px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/210448i3E15F192A2313C73/image-size/medium?v=v2&amp;amp;px=400" role="button" title="codec to webserver.png" alt="codec to webserver.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; Is it it the correct conclusion that Cisco has hobbled the htttp client to not allow production of JSON content? Same seems to be the case for hex string that may be needed for similar process with GlobalCache itach rs232.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 18:51:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5019575#M2797</guid>
      <dc:creator>RoofusThedoofus</dc:creator>
      <dc:date>2024-02-16T18:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5020853#M2798</link>
      <description>&lt;P&gt;That should not be the case. Testing to a request bin site like webhook.site and doing xCommand HttpClient Put with content-type:application/json and a JSON body shows the JSON is properly received.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 18:20:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5020853#M2798</guid>
      <dc:creator>Jeff Marshall</dc:creator>
      <dc:date>2024-02-19T18:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5020992#M2799</link>
      <description>&lt;P&gt;I did point it to Apiary API mock server, and then it came back as OK. When I changed it to the actual GC device, it got error 415.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 06:47:51 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5020992#M2799</guid>
      <dc:creator>gmathilassi</dc:creator>
      <dc:date>2024-02-20T06:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Status Code 415</title>
      <link>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5020998#M2800</link>
      <description>&lt;P&gt;When I try to send it to Apirary Mock server, it works like a dream. But when I send it directly to GC, it returns 415 error. And the codes are the same, except address.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 06:53:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/webex-for-developers/status-code-415/m-p/5020998#M2800</guid>
      <dc:creator>gmathilassi</dc:creator>
      <dc:date>2024-02-20T06:53:32Z</dc:date>
    </item>
  </channel>
</rss>

