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

Update Opportunity Using rest API; Error : 400 bad request in response
Example for creating Opportunity :
curl https://na1.salesforce.com/services/data/v20.0/sobjects/Opportunity/0AASSFGSEID -H "Authorization: Bearer token" -H "Content-Type: application/json" -d @newrecord.json -X PATCHExample request body newrecord.json file :
{ "Name":"FFNEw","CloseDate":"2015/02/04","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/0AASSFGSEID")); request.Method = "PATCH"; 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()".
To start with, I have done similar scenario. However I had Salesforce applications as both the calling and receiving ends. And I observed that though Salesforce API supports PATCH method but when we use it programatically it errors. The error is "Invalid HTTP method: PATCH".
So my first question is, did you check logs for your calling application? Are you getting any errors while calling Salesforce using the PATCH method.
Anyways, you can try using the below modified end point. It should work for you as it did for me.
"/services/data/v20.0/sobjects/Opportunity/0AASSFGSEID?_HttpMethod=PATCH"
Also remember to change the calling method to post. So your code should look like the below -
Thanks
AR
If the reply is helpful and solves your problem then please mark it as best.
your ans is So help full for me thank you so much...........
thanks
kullayappa