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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using <strong>REST</strong> <strong>API</strong> ResourcesExecute a SOQL QueryThe examples in this section use <strong>REST</strong> <strong>API</strong> resources to search and query records using <strong>Salesforce</strong> Object Search Language(SOSL) and <strong>Salesforce</strong> Object Query Language (SOQL). For more information on SOSL and SOQL see the <strong>Database</strong>.<strong>com</strong>SOQL and SOSL Reference.Execute a SOQL QueryUse the Query resource to execute a SOQL query that returns all the results in a single response, or if needed, returns part ofthe results and an identifier used to retrieve the remaining results.The following query requests the value from name fields from all Widget records.Example usage for executing a querycurl https://na1.salesforce.<strong>com</strong>/services/data/v20.0/query/?q=SELECT+name+from+Widget__c-H "Authorization: Bearer token"Example request body for executing a querynone requiredExample response body for executing a query{"done" : true,"totalSize" : 14,"records" :[{"attributes" :{"type" : "Widget__c","url" : "/services/data/v20.0/sobjects/Widget__c/a01D000000IRFmaIAH"},{},},"Name" : "Test 1""attributes" :{"type" : "Widget__c","url" : "/services/data/v20.0/sobjects/Widget__c/a01D000000IomazIAB"},"Name" : "Test 2"...}]Retrieving the Remaining SOQL Query ResultsIf the initial query returns only part of the results, the end of the response will contain a field called nextRecordsUrl. Forexample, you might find this attribute at the end of your query:"nextRecordsUrl" : "/services/data/v20.0/query/01gD0000002HU6KIAW-2000"42

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

Saved successfully!

Ooh no, something went wrong!