In your HTTP request, you can specify the record fields whose values you want to retrieve. You can programmatically parse the retrieved records, filter them if necessary, and work with the records that meet your criteria.


To try out the steps in this section, install Postman and open the Postman collection we have prepared for you. In the collection, open the Retrieve all records of the same type request and replace variables with actual values.

Download Postman Open Postman Collection


Step 1: Create a GET request

Configure your application to send the following GET request that uses the Salesforce Object Query Language (SOQL):

GET https://{your_Salesforce_domain}/services/data/v44.0/queryAll?q=SELECT {field 1}, {field 2}, {field n} FROM {resource}

where

TIP: To view what record types you can retrieve, in Financials, go to Setup > Object Manager. Available record types are listed in the API NAME column. Record types related to Financials have the following name format: s2cor__Sage_{name}__c.
To view the fields whose values you can retrieve for a record type, in Financials, go to Setup > Object Manager. In the LABEL column, click the record type. Click Fields & Relationships. The available fields are listed in the FIELD NAME column.


Step 2: Configure authorization

Make sure your request uses OAuth 2.0. Authorization data must be included in the request URL.


Step 3: Configure headers

Configure the request headers to include the following key-value pairs:

Key Value
Authorization Bearer {access_token}
Example:
Bearer 00D0N000000h6Yq!AR0AQObORnk9lCldrMydk1Y3cuyqpscqcU.T1xvoM1uWkWrr8MLu2ehJLKp7Mz3Qeu.eQGI13qlH_HfGEEMxV_J8FdI1TwdR
Content-Type application/json

Step 4: Send your request

Send your request and parse the response. The JSON payload you receive contains the records and fields specified in your request. Below are example request and response.


Example request

GET https://my-domain.salesforce.com/services/data/v44.0/queryAll?q=SELECT Id, Name FROM s2cor__Sage_COR_Company__c

This request retrieves all Company records (s2cor__Sage_COR_Company__c) together with their Id and Name field values from the my-domain.salesforce.com domain via version 41.0 of the Force.com REST API.


Example response

{
    "totalSize": 3,
    "done": true,
    "records": [
        {
            "attributes": {
                "type": "s2cor__Sage_COR_Company__c",
                "url": "/services/data/v44.0/sobjects/s2cor__Sage_COR_Company__c/a1E0N000007Q2T3UAK"
            },
            "Id": "a1E0N000007Q2T3UAK",
            "Name": "Canadian Consulting"
        },
        {
            "attributes": {
                "type": "s2cor__Sage_COR_Company__c",
                "url": "/services/data/v44.0/sobjects/s2cor__Sage_COR_Company__c/a1E0N000007Q2T4UAK"
            },
            "Id": "a1E0N000007Q2T4UAK",
            "Name": "Australia Consulting"
        },
        {
            "attributes": {
                "type": "s2cor__Sage_COR_Company__c",
                "url": "/services/data/v44.0/sobjects/s2cor__Sage_COR_Company__c/a1E0N000007Q2T5UAK"
            },
            "Id": "a1E0N000007Q2T5UAK",
            "Name": "United Kingdom Consulting"
        }
    ]
}