You need to sign in to do that
Don't have an account?

Create Opportunity Using rest API; Error : 400 bad request in response
Example for creating Opportunity :
I am able to create Account using same code. I don't Know what wrongs with Opportunity.
curl https://na1.salesforce.com/services/data/v20.0/sobjects/Opportunity/ -H "Authorization: Bearer token" -H "Content-Type: application/json" -d @newrecord.json -X PATCHExample request body newrecord.json file :
{ "Name":"FFNEw","CloseDate":"3/2/2015","StageName":"Prospecting","Probability":10 }My ASP.net code :
using (WebClient client = new WebClient()) { client.Headers.Add("Authorization", "Bearer " + token.access_token); client.Headers.Add("Content-Type", "application/json"); var request = (HttpWebRequest)(HttpWebRequest.Create(token.instance_url + "/services/data/v20.0/sobjects/Opportunity/")); request.Method = "POST"; using (var requestWriter = new StreamWriter(request.GetRequestStream())) { requestWriter.Write(json); requestWriter.Flush(); requestWriter.Close(); } var response = request.GetResponse(); }Getting Error 400 Bad Request in "request.GetResponse()".
I am able to create Account using same code. I don't Know what wrongs with Opportunity.
use "CloseDate":"2015-03-02"
All Answers
use "CloseDate":"2015-03-02"
(400) Bad Request is mostly due to incorrect JSON.
You can use workbench to send the JSON Request and see what you are getting.
https://workbench.developerforce.com/login.php
I am sure it is about the date format and you should have date as "2015-03-02"
I am able to create single record using above code. But can't create multiple records.
My request string is : Error in .net Code : 400 bad request
Error in Workbench : errorCode: METHOD_NOT_ALLOWED
message: HTTP Method 'POST' not allowed. Allowed are HEAD,GET
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");