0

I'm working with Salesforce Rest APIs, as we can get records to call this example endpoint https://mydomainname.my.salesforce.com/services/data/v55.0/sobjects/Account/001D000000INjVe.

I want to get a record from the Account Object on the basis of the value in a specific column. Is that possible to get a record by passing the field API Name and Value? Correct me if I'm wrong.

3
  • Do you want to pass dynamic ID ?
    – MIX DML
    Commented Aug 31, 2022 at 11:18
  • Probably you want to use the query resource instead? eg. /services/data/v55.0/query/?q=SELECT+name+from+Account+where+field=value Commented Aug 31, 2022 at 12:10
  • @hengkyDjapar Thank you it works. Commented Aug 31, 2022 at 13:18

1 Answer 1

0

No, you cannot use arbitrary fields to retrieve a single record from the "sobjects" resource through the REST API.

Your options are to use the record Id, or use a field marked as an "external id". I'm not sure what would happen if a single external Id were to be used on multiple records.

Beyond that, you would either need to create your own custom REST endpoint (using Apex) or use the "query" resource.

1
  • I have set the field as External Id that works. Commented Aug 31, 2022 at 14:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .