You need to sign in to do that
Don't have an account?

Rest Apex Api class clarification needed
Hi Friends,
I am learning Integration and I need some clarification for the below question.
Scenario:
I have 3 methods in REST Api class,
@HttpGet
@HttpPost
@HttpPut
I have all the methods in single class.
Question:
Whether I can use each method in each class.
Like, @HttpGet in one class and @HttpPost in one class..
So that If I want to make any changes to particulat method only that class and corresponding test class is modified.
Kinldly need some inputs for my understanding.
Thanks.
I am learning Integration and I need some clarification for the below question.
Scenario:
I have 3 methods in REST Api class,
@HttpGet
@HttpPost
@HttpPut
I have all the methods in single class.
Question:
Whether I can use each method in each class.
Like, @HttpGet in one class and @HttpPost in one class..
So that If I want to make any changes to particulat method only that class and corresponding test class is modified.
Kinldly need some inputs for my understanding.
Thanks.
You can put methods in different classes, when you specify api to end user u need to specify according to your class rest resource mapping. means which api is for get and which is for post like that.
All Answers
Please follow below URL. Below URL will explain you everything in very detail and with proper example.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotations_rest.htm
Thanks
Hemant
Please follow below URL. Below URL will explain you everything in very detail and with proper example.
https://ankskills.com/tutorials/rest-api-in-salesforce/
Thanks
Sarbjeet
You can put methods in different classes, when you specify api to end user u need to specify according to your class rest resource mapping. means which api is for get and which is for post like that.