+ Start a Discussion
HTANIRSHTANIRS 

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.
Hemant_SoniHemant_Soni
Hi,
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
Sarbjeet Singh HayerSarbjeet Singh Hayer
Hi HTANIRS,
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
 
Ujwala Mane 17Ujwala Mane 17
Hi,

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.