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?

  • 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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.