I'm learning basics of using Rest API and using workbench to explore it .

As of now , I'm correctly able to make get Call to salesforce for e.g


is bringing me details of the record mentioned above

Now I'm testing POST via Rest API To SFDC. This is the area where I'm having problems and doubts.

My first question.

as I'm trying to create Account record via post request , is there a standard similar way, like above(which is GEt request to retrieve data) to create record and get ID back via POST ?

I tried hard to search but what I got are Salesforce articles is : this can be done by creating your own rest resource(Custom class exposed as Rest Resource like in this way

@RestResource(URLMapping = '/SingleAccounInsert/*')

 Global class CreateSingleAccount {

  Global static string  CreateAcc( string nm, string Descrip, String Type, String area){
  Account acc = new Account();
  acc.name = nm ;
  acc.Description = Descrip;
  acc.Type = Type;
  acc.Area__c= area;
  insert acc ;
  return acc.Id;
 } }

Second question :

Even If try to use above rest resource and post following data to SFDC on URL :


  "name" : "Sansui Corp",
  "description" : "Electronics Buys",
  "Type" : "XYZ",
  "Area__c" : "USA"


message: Unexpected parameter encountered during deserialization: name at [line:2, column:13] errorCode: JSON_PARSER_ERROR

I'm stuck now, not sure how to test POST Requests.

Articles referred :



2 Answers 2


Yes there is standard way to create any record in Salesforce via POST


replace OBJECTNAME with object name for which you want to insert the record.

for example Account record can be created as follows

enter image description here

If you want to update account you need to pass Account id in url and select PATCH as method type


JSON in body


"NAME":"Erase item"

enter image description here

  • Thanks , this actually works But have one question. If Suppose I've to update same account, should I've to use PATCH as POST is not working and getting following error : METHOD_NOT_ALLOWED errorCode: METHOD_NOT_ALLOWED message: HTTP Method 'POST' not allowed. Allowed are HEAD,GET,PATCH,DELETE. I tried to use PATCH also, through update is happening, but getting 204 as response
    – sfdc_Qrius
    Commented Dec 13, 2015 at 10:56
  • check the updated answer
    – Himanshu
    Commented Dec 13, 2015 at 16:58

You can use standard REST API as showed by above answer .Also i would like to point out mistake you are doing in the custom REST API

The JSON parameters that you send should match the parmeters of the @HTTP POST function of apex .Hence your proper JSON as per function you have written would be as below

 "nm" : "Sansui Corp",
 "Descrip" : "Electronics Buys",
  "Type" : "XYZ",
 "area" : "USA"
  • Thanks Mohith for pointing out this mistake!! I could only mark only as answer so for now, could only give + 1 to your answer .
    – sfdc_Qrius
    Commented Dec 13, 2015 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .