<?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 Why does authnet endpoint return XML instead of JSON? in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Why-does-authnet-endpoint-return-XML-instead-of-JSON/m-p/62633#M36911</link>
    <description>&lt;P&gt;In my custom PHP libs I have my Accept.js integrations working perfectly. I use very stripped-down calls, not the bloated authnet SDKs. I send XML to the endpoint (&lt;A href="https://apitest.authorize.net/xml/v1/request.api" target="_blank"&gt;https://apitest.authorize.net/xml/v1/request.api&lt;/A&gt;), and I get back JSON, and my client-side js is able to parse the json and all is good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the problem: Now I'm trying to do the same thing with .NET (c#) instead of PHP, for a different client. The Accept.js works fine (it's the same as with PHP, still on client), and even the .NET works fine and succeeds the transaction BUT I get back XML instead of JSON from authnet. All my client-side js logic is built around json structures so I'd love to keep using that and not have to rewrite it all to parse and examine returned XML.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In summary: In my .NET calls I still want to send in XML, but I want to get back JSON in the response, as happens with my PHP calls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have compared my php calls and my .NET calls, and while the plumbing is different, the basic stuff seems to be all the same. I can't find any parameter or flag or indicator that says "get back JSON" or "get back XML".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I tell authnet api endpoint to return JSON instead of XML in my call to (for example)&amp;nbsp;createTransactionRequest? Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Note: There's a newtonsoft lib that converts xml to json, and I got that to work, but the result is very different compared to the json that authnet sends pack, so the js json parsing all breaks.)&lt;/P&gt;</description>
    <pubDate>Sat, 14 Apr 2018 23:23:45 GMT</pubDate>
    <dc:creator>ZeroGravPro</dc:creator>
    <dc:date>2018-04-14T23:23:45Z</dc:date>
    <item>
      <title>Why does authnet endpoint return XML instead of JSON?</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Why-does-authnet-endpoint-return-XML-instead-of-JSON/m-p/62633#M36911</link>
      <description>&lt;P&gt;In my custom PHP libs I have my Accept.js integrations working perfectly. I use very stripped-down calls, not the bloated authnet SDKs. I send XML to the endpoint (&lt;A href="https://apitest.authorize.net/xml/v1/request.api" target="_blank"&gt;https://apitest.authorize.net/xml/v1/request.api&lt;/A&gt;), and I get back JSON, and my client-side js is able to parse the json and all is good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the problem: Now I'm trying to do the same thing with .NET (c#) instead of PHP, for a different client. The Accept.js works fine (it's the same as with PHP, still on client), and even the .NET works fine and succeeds the transaction BUT I get back XML instead of JSON from authnet. All my client-side js logic is built around json structures so I'd love to keep using that and not have to rewrite it all to parse and examine returned XML.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In summary: In my .NET calls I still want to send in XML, but I want to get back JSON in the response, as happens with my PHP calls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have compared my php calls and my .NET calls, and while the plumbing is different, the basic stuff seems to be all the same. I can't find any parameter or flag or indicator that says "get back JSON" or "get back XML".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I tell authnet api endpoint to return JSON instead of XML in my call to (for example)&amp;nbsp;createTransactionRequest? Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Note: There's a newtonsoft lib that converts xml to json, and I got that to work, but the result is very different compared to the json that authnet sends pack, so the js json parsing all breaks.)&lt;/P&gt;</description>
      <pubDate>Sat, 14 Apr 2018 23:23:45 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Why-does-authnet-endpoint-return-XML-instead-of-JSON/m-p/62633#M36911</guid>
      <dc:creator>ZeroGravPro</dc:creator>
      <dc:date>2018-04-14T23:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why does authnet endpoint return XML instead of JSON?</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Why-does-authnet-endpoint-return-XML-instead-of-JSON/m-p/62635#M36913</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/7048"&gt;@ZeroGravPro&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For json you need to pass the&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Content-Type&lt;/SPAN&gt; header as&amp;nbsp;&lt;SPAN&gt;application/json in your request .&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTTP Request Method:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;POST&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Sandbox API Endpoint:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;&lt;A href="https://apitest.authorize.net/xml/v1/request.api" target="_blank"&gt;https://apitest.authorize.net/xml/v1/request.api&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Production API Endpoint:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;&lt;A href="https://api.authorize.net/xml/v1/request.api" target="_blank"&gt;https://api.authorize.net/xml/v1/request.api&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;XML Content-Type:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;text/xml&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;JSON Content-Type:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;application/json&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;API Schema (XSD):&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd" target="_blank"&gt;https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps !!&lt;/P&gt;</description>
      <pubDate>Sun, 15 Apr 2018 20:19:04 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Why-does-authnet-endpoint-return-XML-instead-of-JSON/m-p/62635#M36913</guid>
      <dc:creator>Anurag</dc:creator>
      <dc:date>2018-04-15T20:19:04Z</dc:date>
    </item>
  </channel>
</rss>

