13.07.2015 Views

Database.com REST API Developer's Guide - Salesforce.com

Database.com REST API Developer's Guide - Salesforce.com

Database.com REST API Developer's Guide - Salesforce.com

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Introducing Force.<strong>com</strong> <strong>REST</strong> <strong>API</strong>Using CompressionAuthenticationThe Force.<strong>com</strong> <strong>REST</strong> <strong>API</strong> supports OAuth 2.0 (an open protocol to allow secure <strong>API</strong> authorization). See UnderstandingAuthentication for more details.Support for JSON and XMLJSON is the default. You can use the HTTP ACCEPT header to select either JSON or XML, or append .json or .xmlto the URI (for example, /Widget__c/a01D000000INjVe.json).The JavaScript Object Notation (JSON) format is supported with UTF-8. Date-time information is in ISO8601 format.XML serialization is similar to SOAP <strong>API</strong>. XML requests are supported in UTF-8 and UTF-16, and XML responsesare provided in UTF-8.Using CompressionThe <strong>REST</strong> <strong>API</strong> allows the use of <strong>com</strong>pression on the request and the response, using the standards defined by the HTTP1.1 specification. Compression is automatically supported by some clients, and can be manually added to others. Visit DeveloperForce for more information on particular clients.Tip: For better performance, we suggest that clients accept and support <strong>com</strong>pression as defined by the HTTP 1.1specification.To use <strong>com</strong>pression, include the HTTP header Accept-Encoding: gzip or Accept-Encoding: deflate in a request.The <strong>REST</strong> <strong>API</strong> <strong>com</strong>presses the response if the client properly specifies this header. The response includes the headerContent-Encoding: gzip or Accept-Encoding: deflate. You can also <strong>com</strong>press any request by including aContent-Encoding: gzip or Content-Encoding: deflate header.Response CompressionThe <strong>REST</strong> <strong>API</strong> can optionally <strong>com</strong>press responses. Responses are <strong>com</strong>pressed only if the client sends an Accept-Encodingheader. The <strong>REST</strong> <strong>API</strong> is not required to <strong>com</strong>press the response even if you have specified Accept-Encoding, but it normallydoes. If the <strong>REST</strong> <strong>API</strong> <strong>com</strong>presses the response, it also specifies a Content-Encoding header.Request CompressionClients can also <strong>com</strong>press requests. The <strong>REST</strong> <strong>API</strong> de<strong>com</strong>presses any requests before processing. The client must send aContent-Encoding HTTP header in the request with the name of the appropriate <strong>com</strong>pression algorithm. For moreinformation, see:• Content-Encoding at: www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11• Accept-Encoding at: www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3• Content Codings at: www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5Using cURL in the <strong>REST</strong> ExamplesThe examples in this guide use the cURL tool to send HTTP requests to access, create, and manipulate <strong>REST</strong> resources onthe Force.<strong>com</strong> platform. cURL is pre-installed on many Linux and Mac systems. Windows users can download a version atcurl.haxx.se/. When using HTTPS on Windows, ensure that your system meets the cURL requirements for SSL.Note: cURL is an open source tool and is not supported by salesforce.<strong>com</strong>.3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!