You need to sign in to do that
Don't have an account?
Michael M
Composing sample JSON for post request
I am new to integrations, so this may be a very basic question. I need to create a mock up of JSON of a sample Salesforce record, to ultimately be able to post to an external API. My question is: is there any required context for constructing the JSON? E.g. do the field names need to equal the API names in salesfroce (e.g. {
"Lead" : [ {
"bed_count__c" : 55}]}
Or- can I assign the fields any name I want? Apologies if this is very basic, but your assitance is greatly helpful.
"Lead" : [ {
"bed_count__c" : 55}]}
Or- can I assign the fields any name I want? Apologies if this is very basic, but your assitance is greatly helpful.
You have to use API names of fields related to object to create, update, delete or any other operation which you want to do using integration.
To write a new Salesforce record, we use a POST request:
https://<yourInstance>.salesforce.com/services/data/v<version>/sobjects/<objectName>/
In the body of the POST request, provide the record data in application/json format:
{
<field1ApiName>: <field1Value>,
<field2ApiName>: <field2Value>,
...
}
You do not need to provide an ID field to Salesforce when creating records, as Salesforce will generate a unique ID value and return it in the response.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Sachin Arora
www.sachinsf.com
All Answers
If I get the question right you want to understand "if you can give any name to the fields or if you will have to use the api names"
To my knowledge you will have to use API names of the fields so that the system can identify the fields when you are doing the operations using the integrations.
Hope I have answered your query please close the thread by marking a best answer so that it would help in keeping our community clean and it might help other people in the future.
Regards,
Anutej.
You have to use API names of fields related to object to create, update, delete or any other operation which you want to do using integration.
To write a new Salesforce record, we use a POST request:
https://<yourInstance>.salesforce.com/services/data/v<version>/sobjects/<objectName>/
In the body of the POST request, provide the record data in application/json format:
{
<field1ApiName>: <field1Value>,
<field2ApiName>: <field2Value>,
...
}
You do not need to provide an ID field to Salesforce when creating records, as Salesforce will generate a unique ID value and return it in the response.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Sachin Arora
www.sachinsf.com
Also, how would I write files that are attached to the record into the JSON?