0

According to this documentation, you need to know the external ID field of an object to inset new records. For some of my custom objects, I'm not seeing any fields in the object description that have an externalId value of true (I'm logged in as an admin).

How do I insert a new record of an object that does't have an external ID field?

Note: I don't have much control over the current object structure

Using REST API v31.0

2 Answers 2

2

REST API means that you can use 'GET', 'POST', 'PATCH' or 'DELETE' as HTTP methods for your requested resource. These methods correspond to what you're trying to achieve. GET = describe, POST = insert, PATCH = update, DELETE = delete. Here's an example of how to insert a new Account using the POST method:

POST /services/data/v31.0/sobjects/Account HTTP/1.1
Host: na15.salesforce.com
User-Agent: Guzzle/4.1.6 curl/7.30.0 PHP/5.4.24
Authorization: Bearer 00Di000000xxxxxx
Accept: application/json
Content-Type: application/json
Content-Length: 24

{"Name":"New Account"}
2

You do not need any ID at all to insert a record. Simply use the REST api and end the endpoint at

instance_url/services/data/v30.0/sobjects/{CustomObject__c}
2
  • Executing the above URL returns a "describe" of the object. And I wouldn't expect a GET request to add an object. Am I missing something? Aug 28, 2014 at 6:58
  • 2
    @contactmatt - Um, thats why you use POST
    – Eric
    Aug 28, 2014 at 13:13

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.