You need to sign in to do that
Don't have an account?
motti10
How can I create a new Contact with REST call?
I am trying to create a Contact in SFDC without assigning it an Account or anything else.
I want to create it and then assign it to a case or Asset , etc
Any ideas?
Thanks
You should be using POST, not PATCH. (23.9 was a typo, which i fixed, its 23.0, but 20.0 should work as well)
All Answers
send a POST to /services/data/v23.0/sobjects/contact the payload should be a json or xml document with the fields you want to set, e.g.
{ "FirstName" : "Simon",
"LastName" : "Fell" }
see the REST API docs for more details.
Hi Simon,
Thanks for the response
That is what I have been trying, (Code is in Groovy)
contact= [
"FirstName":"FName",
"LastName" : "LName"]
def jsonString = JSONObject.fromObject(contact).toString(2)
http.request( POST ) {
contentType = JSON
uri.path = '/services/data/v20.0/sobjects/contact/'
uri.query = [_HttpMethod:'PATCH']
send JSON, jsonString
headers.'Authorization' = "OAuth $accessToken"
}
}
I get a "Method Not Allowed" error. When I use your version v23.9 I get "Not Found"
You should be using POST, not PATCH. (23.9 was a typo, which i fixed, its 23.0, but 20.0 should work as well)
You are the bomb!!! It works great
Thank you so much..