[SalesForce] 2 post method in same rest class with same url one for update and one for delete

I am working on a rest class and have created different type of rest service with a defined URL. However, I was just going on a requirement and looking for the possibility regarding:

Inside same apex rest class with same URL Mapping , Is there possibility to have 2 post method:

  • 1 for delete
  • 2 for update

Best Answer

Each HTTP verb can only be used once per URL. You can use a @HttpPost and @HttpDelete method in the same class. When calling the service, use the appropriate verb (POST or DELETE).

Related Topic