1

I have to integrate SFDC with an external system where I have to insert/update a custom object record. External system team is asking to send a REST request to update/insert the record.

I don't know how make REST request for whole record. It has more than 100 fields. Do i have put all of fields value in URL ???

  • 1
    you can send a rest request wit a json body with the fields but it will depend on how the receiving end expects to get the request – Eric Oct 6 '14 at 0:44
7

You would typically send a POST request, rather than a GET, to insert/update a record, so you could pass your 100+ fields as JSON or XML in the POST body. Check what the external system team is expecting to see!

  • Thanks metadaddy. Got it. I have to create send the record in json request to make insert/update external sys. . Can I serialize the object's record to make the Rest request body. – amidstCloud Oct 6 '14 at 17:33
  • Yes - you can serialize a record with JSON.serialize(myRecord), but that's only going to be helpful if the field names are identical. If they are different in the other system, create an Apex Class with fields to match what 'they' want, create an instance, copy in the data, then call JSON.serialize on that Apex Class instance. – metadaddy Oct 6 '14 at 17:39
  • 1
    Ok. It's a kind of wrapper class to match the field name and datatype with external system. Thanks again. – amidstCloud Oct 6 '14 at 22:16
  • Hi, Could you please provide some code sample for this task. I have same issue. – Khawaja M. Awais Aug 15 '16 at 7:43
  • There are lots of samples out there - check out this article and this blog post. – metadaddy Aug 15 '16 at 18:18

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.