0

I want to use 1 method regardless of whether the request is sent as a Post or Put (upsert).

So, if the request has an Id field populated, it will update the record, if not it will insert.

Can I just use

  @Httppost
  @httpput
  global static string createSetting( ) {
    RestRequest req = RestContext.request;
  ...

and SF will route both requests to the same method?

  • 1
    The compiler wouldn't complain if you do so. And as long as you can verify if it functions as expected, then you can do so. – Jayant Das Feb 4 at 1:19

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.