Example for creating Account

curl https://na1.salesforce.com/services/data/v20.0/sobjects/Account/customExtIdField__c/11999 -H "Authorization: Bearer token" -H "Content-Type: application/json" -d @newrecord.json -X PATCH

Example request body newrecord.json file

"Name" : "Express Logistics and Transport"

My ASP.net code :

using (WebClient client = new WebClient())
     client.Headers.Add("Authorization", "Bearer " + token.access_token);
     client.Headers.Add("Content-Type", "application/json");
     NameValueCollection reqparm = new NameValueCollection();
     reqparm.Add("Name", "This Is Test Data");
     byte[] responsebytes = client.UploadValues(token.instance_url + "/services/data/v20.0/sobjects/Account/customExtIdField__c/11999", "PATCH", reqparm);
     string responsebody = Encoding.UTF8.GetString(responsebytes);

Above code is not working. Getting Error (405) Method Not Allowed. I don't know how to use Patch Method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.