0

I followed instructions on "https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm" to insert a new account record. I get no errors, but the account record does not get created. When I tried same in .Net I see that the response I get from HttpResponseMessage has status as : WaitingForActivation Can you please help me? What is the problem and why I don't get the record created in my instance?

the command I ran is in below (I only replaced myInstance.salesforce.com and token with correct values) :

curl -v https://myInstance.salesforce.com/services/data/v20.0/sobjects/Account/ -H "Authorization: Bearer token" -H "Content-Type: application/json" -d "{"Name" : "test_record1"}"

7
  • Have you tried changing the version to the latest (v45.0) and see if that works? – Jayant Das Apr 3 '19 at 21:34
  • which software version you are talking about Das? – Azi Apr 4 '19 at 16:24
  • The API version as in the URL (.../v20.0/sobjects/...), instead of v20.0, have you tried with v45.0? – Jayant Das Apr 4 '19 at 16:27
  • Yes I just tried with v45.0, same issue. – Azi Apr 4 '19 at 18:33
  • Have you tried from a different client, say POSTMAN? – Jayant Das Apr 4 '19 at 18:39
1

The quotes need to be escaped properly. The problem is with this bit:

"{"Name" : "test_record1"}"

This causes the shell to treat the quotes wrong. The following change should work:

"{\"Name\" : \"test_record1\"}"

Also, instead of dealing with escapes, you can also just make a file:

curl -v https://myInstance.salesforce.com/services/data/v20.0/sobjects/Account/ -H "Authorization: Bearer token" -H "Content-Type: application/json" -d @payload.json

Where payload.json is the name of the file you want to send.

1
  • Thanks sfdcfox, I see your point, but problem is still there. So I get no error but no record got created. I have tried with both "{\"Name\" : \"test_record1\"}" passing straight in command line and also having "{"Name" : "test_record1"}" in a json file and passing the json file in command line. – Azi Apr 3 '19 at 21:17

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.