1

I need to remotely query salesforce for 1000 records using REST, via POST (I can't be passing my external IDs over a GET query: they'd get logged in salesforce's web log files bad practice).

Using the Composite API won't work for me, since it requires that I query by salesforce id (I need to query by another text field):

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections_retrieve.htm

0

For posterity, I think I found an answer:

Using the Parameterized Search API, I can query this endpoint:

/services/data/v45.0/parameterizedSearch

with this POST body:

{
  "q" : "Account",    
  "sobjects":[{"name":"Account",    
  "where":"External_ID__c = 'Account.050' or External_ID__c = 'Account.001' or External_ID__c = 'Account.12345'"}],    
  "fields":["id", "name"] 
}

Caveat: "q" : "Account" : this is the search term - all my records have an text field with an external identifier where the prefix is 'Account'...
(FYI, this query field does not appear to be able to take arrays as a search term. It also has to be longer than 1 character.)

The way I search for multiple specific values is to find them all with a generic search value in "q", and then get specific in the WHERE clause with ORs.

I don't know how large by POST body can be, or how large the "Where" clause can be... but this is progress.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.