I am new to salesforce development. I wonder what is the correct rest api if I want to get a standard object by using a field instead of id? For example, if I want to get a contact record by id, I try below command:
curl https://cs10.salesforce.com/services/data/v33.0/sobjects/Contact/Id/003J000001CxKKsIAN -H "Authorization: Bearer myAccessToken" -H "Content-Type: application/json" -X GET
(I know Node "Id" could be omitted) it returns as expected:
{"attributes":{"type":"Contact","url":"/services/data/v33.0/sobjects/Contact/003J000001CxKKsIAN"},"Id":"003J000001CxKKsIAN","IsDeleted":false,"MasterRecordId":null,"AccountId":"001J000001bXQZHIA4",...}
However, if I want to retrieve this record by account id:
curl https://cs10.salesforce.com/services/data/v33.0/sobjects/Contact/AccountId/001J000001bXQZHIA4 -H "Authorization: Bearer myAccessToken" -H "Content-Type: application/json" -X GET
it returns error:
[{"errorCode":"NOT_FOUND","message":"Provided external ID field does not exist or is not accessible: AccountId"}]
What is the correct example for my case?