I want to create a single POST method which takes method as a parameter along with the Request body. Using the parameter string method i'm trying to call the related method within my apex controller. But everytime I call this REST API using workbench and passing the method value i'm getting null value for method.


    global without sharing class Automation_SFEndPoint{
        global static String handleMethod(string method){
            if(method == 'Create_something'){
                //have some logic
            if(method == 'Create_somethingElse'){
                //have some logic
    //debug log for method is coming null every time


  • 1
    Welcome to SFSE. I don't see a question articulated here or enough detail to be sure about what's wrong. Could you please take a moment to review How to Ask and help center, then edit your post to add more details so the community can help you?
    – David Reed
    Nov 27, 2020 at 20:20
  • Please also show us what is your request body, request URL and I dont see a return statement. Please also paste full code for handleMethod but remove the business logic. It might be returning null correctly. Nov 28, 2020 at 0:37

1 Answer 1


In order for this to work, you need to format your request in a very specific way. First, the Content-Type header must be set to application/json or application/xml. Then, you must provide the appropriate JSON or XML:


{ "method": "Hello World" }


  <method>Hello World</method>

You can read more in the documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.