Query
Use the Query resource to return records from other clouds and orgs.
Syntax
- Resource
-
1/dfs/apiVersion/metadataRepository/repositoryVersion/entity?$select=query - Available since release
- v3.0
- Formats
- OData 4.0
- HTTP methods
- GET
- Authentication
-
Provided by Salesforce via Cloud to Cloud authentication. This means that the named credential cannot be called directly and must be called via Salesforce. For example, via the developer console, an Apex resource, or component.
- Request body
- N/A
- Request parameters
-
Parameter Description $select Required. Selects data to return. The query selects entities and attributes in the Cloud Information Model (CIM). Data from all data sources that are mapped to those entities and attributes are returned.
For example: $select=Id,ExternalRecordId,OrderNumber,GrandTotalAmount
$filter Optional. Specify a condition to narrow the results returned. Only the EQ operator is supported. However, other operators might work depending on the type of data source you are querying.
For example: $filter=ExternalRecordId. The ExternalRecordID is used to filter on the global party ID.
$orderby Optional. Orders returned results. This uses the ODATA orderby operators and syntax.For example: $orderby=OrderNumber asc
$top Limits the maximum number of records returned. This must be an integer over 0.
For example: $top=5
$expand Only $select is supported as a query parameter in an $expand query. The depth of a nested $expand query that is allowed depends on the data source you are querying.
For example: $expand=BillToAddressId($select=AddressLine1,CityName,PostalCodeText,StateProvinceName),SalesOrderProducts($select=OrderedQuantity,Description,ListPriceAmount,LineAdjustmentSubTotalAmount,TotalTaxAmount,TotalLineAmount;
Example
This example queries the SalesOrder entity by the order number and returns the grand total amount and order number.
1'SalesOrder?$filter=OrderNumber%20eq%20%27SiteGenesis__00000202%27&$select=GrandTotalAmount,OrderNumber';