I want to expose a Rest service class with a method with @HttpPost annotation. Below is the code snippet for what I am doing
@RestResource(urlMapping='/webhook')
global class Services {
@HttpPost
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?
Thanks
GET
andPOST
, you need to write two separate methods annotated as such...POST