<?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 Can the ArcGIS Server rest api response header content-type be set to application/json when request is for a json response? in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/can-the-arcgis-server-rest-api-response-header/m-p/576020#M3876</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In ArcGIS Server 10.1 rest api response header content-type is set to&amp;nbsp;text/plain when the request is for json. &amp;nbsp;In later versions of ArcGIS Server can the content-type be set to application/json for a rest service response? Trying to use Springs HttpMessageConverter to map json response to Java object, but it relies on the Content-type header of response.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jan 2017 18:52:37 GMT</pubDate>
    <dc:creator>DavidGiannone</dc:creator>
    <dc:date>2017-01-05T18:52:37Z</dc:date>
    <item>
      <title>Can the ArcGIS Server rest api response header content-type be set to application/json when request is for a json response?</title>
      <link>https://community.esri.com/t5/developers-questions/can-the-arcgis-server-rest-api-response-header/m-p/576020#M3876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In ArcGIS Server 10.1 rest api response header content-type is set to&amp;nbsp;text/plain when the request is for json. &amp;nbsp;In later versions of ArcGIS Server can the content-type be set to application/json for a rest service response? Trying to use Springs HttpMessageConverter to map json response to Java object, but it relies on the Content-type header of response.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2017 18:52:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/can-the-arcgis-server-rest-api-response-header/m-p/576020#M3876</guid>
      <dc:creator>DavidGiannone</dc:creator>
      <dc:date>2017-01-05T18:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can the ArcGIS Server rest api response header content-type be set to application/json when request is for a json response?</title>
      <link>https://community.esri.com/t5/developers-questions/can-the-arcgis-server-rest-api-response-header/m-p/576021#M3877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am using arcgis server 10.3 and it seems we cannot set the request header Content-type to application/json.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this real example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var postData = {"foo": "bar", "f": "json"};&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var xhr = new XMLHttpRequest();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xhr.open("POST", &lt;A class="link-titled" href="https://carto48dev.education.gouv.qc.ca/arcgis/rest/services/DEV/" title="https://carto48dev.education.gouv.qc.ca/arcgis/rest/services/DEV/"&gt;https://mydomain.com/arcgis/rest/services/DEV/testService/GPServer/test/execute&lt;/A&gt; , true);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xhr.setRequestHeader("Content-type", "application/json");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xhr.onreadystatechange = function () {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (xhr.readyState == 4 &amp;amp;&amp;amp; xhr.status == 200) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resolve(JSON.parse(xhr.response));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xhr.send(JSON.stringify(postData));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here is the Response Header:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Access-Control-Allow-Origin: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Flocalhost%3A8080" rel="nofollow" target="_blank"&gt;http://localhost:8080&lt;/A&gt;&lt;BR /&gt;Cache-Control: max-age=0,must-revalidate, max-age=60&lt;BR /&gt;Connection: Keep-Alive&lt;BR /&gt;Content-Type: text/html;charset=utf-8&lt;BR /&gt;Date: Thu, 19 Jan 2017 18:21:59 GMT&lt;BR /&gt;Expires: Thu, 19 Jan 2017 18:25:32 GMT&lt;BR /&gt;Keep-Alive: timeout=15, max=100&lt;BR /&gt;Server: &lt;BR /&gt;Set-Cookie: sto-id-47873-cartod=CHHFBJKMFAAA; Domain=mydomain.com; Expires=Sun, 17-Jan-2027 18:21:59 GMT; Path=/&lt;BR /&gt;Transfer-Encoding: chunked&lt;BR /&gt;Vary: Origin&lt;BR /&gt;X-Frame-Options: SAMEORIGIN&lt;BR /&gt;X-XSS-Protection: 1; mode=block&lt;BR /&gt;access-control-allow-credentials: true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here is the Request Header:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Host: mydomain.com&lt;BR /&gt;User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0&lt;BR /&gt;Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;BR /&gt;Accept-Language: en-US,en;q=0.5&lt;BR /&gt;Accept-Encoding: gzip, deflate, br&lt;BR /&gt;Access-Control-Request-Method: POST&lt;BR /&gt;Access-Control-Request-Headers: content-type&lt;BR /&gt;&lt;SPAN&gt;origin: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Flocalhost%3A8080" rel="nofollow" target="_blank"&gt;http://localhost:8080&lt;/A&gt;&lt;BR /&gt;DNT: 1&lt;BR /&gt;Connection: keep-alive&lt;BR /&gt;Pragma: no-cache&lt;BR /&gt;Cache-Control: no-cache&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And nothing appears in the posted params. Nothing is posted, nothing in the response neither.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 18:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/can-the-arcgis-server-rest-api-response-header/m-p/576021#M3877</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2017-01-19T18:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can the ArcGIS Server rest api response header content-type be set to application/json when request is for a json response?</title>
      <link>https://community.esri.com/t5/developers-questions/can-the-arcgis-server-rest-api-response-header/m-p/576022#M3878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I misread your question, I though you were actually wanted to post data as json string.&lt;/P&gt;&lt;P&gt;I dont know if you can change some parameters in arcgis server but by default the ResponseHeader Content-type is set to "application/x-www-form-urlencoded" when using the json output format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 18:42:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/can-the-arcgis-server-rest-api-response-header/m-p/576022#M3878</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2017-01-19T18:42:59Z</dc:date>
    </item>
  </channel>
</rss>

