I want to expose a Rest service class with a method with @HttpPost annotation. Below is the code snippet for what I am doing

global class Services {
    global static String createNewCase() {

     return 'Done';

But When I call these services, this throw error

    "errorCode": "METHOD_NOT_ALLOWED",
    "message": "HTTP Method 'GET' not allowed. Allowed are POST"

If I make the method @HttpGet, it works

Have anyone any Idea why @HttpPost is not working?

enter image description here


  • If you want to support both GET and POST, you need to write two separate methods annotated as such...
    – Adrian Larson
    Jan 6, 2016 at 17:28
  • I Just want to support POST Jan 6, 2016 at 17:30
  • It sounds like when you are testing you are going a GET not a POST.
    – Keith C
    Jan 6, 2016 at 17:33
  • @KeithC I am doing a post request and getting the error response Jan 6, 2016 at 17:36
  • picpaste.com/Capture-yZu4O6II.PNG Above link is the snapshot of request I am making Jan 6, 2016 at 17:40

1 Answer 1


I found the problem as I make my site secure by HTTPS and was doing a request on HTTP, So the post request was discarded.


  • may i know how to resolve this?
    – sdandamud1
    Jun 12, 2020 at 4:02

You must log in to answer this question.

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