You need to sign in to do that
Don't have an account?
Multiple Post methods in a REST controller
Hello,
Is it possible to create multiple POST request which in same controller with some sort of identifier? I could have created custom switch statements but then I need to parse json and it's just a pain as there is no good way to do it in Apex. Thanks, Kam
e.g.
@RestResource(urlMapping='/ContactAccountController/*')
global class DealAccountRestResource {
@HttpPost
global static String createAccount(Account account) {
return account.id;
}
@HttpPost
global static String createContact(Contact c) {
return c.id;
}
@HttpPost
global static String updateContact(Contact c) {
return c.id;
}
This is good feedback. Thanks for sharing with us.
--alex
The answer to this question is not currently. Your design wouldn't work because there's no way to know which POST method to use. But the overall request makes sense. Thanks for the feedback.