Additional Formats

Version 22.0.8500


Additional Formats


In addition to the default JSON format that all resources and actions support, the API also supports the following formats: XML, JSONP, SOAP, RSS, HTML, CSV and TSV.

XML

You can request the XML (OData Atom) format by adding the $format=atom query parameter or by adding the HTTP Accept header with the value application/xml to the request. See the example request and response below.

Request

http://MyServer:MyPort/api.rsc/Cars?$format=atom

Response:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://MyServer:MyPort/api.rsc/"
      xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:info="http://www.rssbus.com/ns?RsbOps/v2/"
      xmlns:d="http://docs.oasis-open.org/odata/ns/data">
  <title type="text">Cars</title>
  <id>http://MyServer:MyPort/api.rsc/Cars/</id>
  <updated>2015-04-23T18:36:20-04:00</updated>
  <entry>
  <title>1000</title><id>http://MyServer:MyPort/api.rsc/Cars('1000')</id>
  <category term="CData.Cars" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
  <link rel="edit" title="Cars" href="Cars('1000')"/>
  <content type="application/xml">
    <m:properties>
      <d:Id m:type="String">1000</d:Id>
      <d:Model m:type="String">Accord</d:Model>
    </m:properties>
  </content>
  </entry>
</feed>

JSONP

You can request the JSONP format by adding the $callback=myCallback query parameter, where “myCallback” is the name of the function you would like to wrap the JSON result. See the example request and response below.

Request

http://MyServer:MyPort/api.rsc/Cars?$callback=myCallback

Response

myCallback(
  {
    "@odata.context": "http://MyServer:MyPort/api.rsc/$metadata#Cars",
    "value": [
      {
        "Id": "1000",
        "Model": "Accord"
      },
      ...
    ]
  }
);

RSS

You can request the RSS format by adding the @rss query parameter to the request. See the example request and response below.

Request

http://MyServer:MyPort/api.rsc/Cars?@rss

Response

<rss xmlns:rsb="http://www.rssbus.com/ns?RsbOps/v2/" xmlns:ls="http://www.microsoft.com/schemas/rss/core/2005"
     xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:x="http://www.rssbus.com/ns?RsbOps/v2/anonymous/"
     xmlns:odata="http://www.rssbus.com/ns?RsbOps/v2/anonymous/" xmlns:info="http://www.rssbus.com/ns?RsbOps/v2/anonymous/"
     xmlns:data="http://www.rssbus.com/ns?RsbOps/v2/anonymous/" version="2.0">
  <channel>
    <description>Retrieves and updates Cars information</description>
    <generator>RSSBus - http://www.rssbus.com</generator>
    <link>http://MyServer:MyPort/api.rsc/Cars?@html</link>
    <title>Cars</title>
    <item xmlns:x="http://www.rssbus.com/ns?RsbOps/v2/anonymous/">
      <x:Id>1000</x:Id>
      <x:Model>Accord</x:Model>
    </item>
  </channel>
</rss>

HTML

You can request the API response to be formatted as a simple, unstyled HTML table by adding the @html query parameter to the request. See the example request and response below.

Request

http://MyServer:MyPort/api.rsc/Cars?@html

Response

<table>
  <tr><th>Id</th><th>Model</th></tr>
  <tr><td>1000</td><td>Accord</td></tr>
</table>

CSV/TSV

You can request the API response to be formatted as CSV or TSV data by adding the @csv or @tsv query parameter to the request. See the example request and response below.

Request

http://MyServer:MyPort/api.rsc/Cars?@csv

Response

Id,Model
1000,Accord