function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AbAb 

expose a Class as a REST Service

Hello,

I want to expose a Class as a REST Service and looking for learning materials for the same

I fould below link with well defined steps,
 
@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
    @HttpGet
    global static Account getRecord() {
        // Add your code
    }
}

https://trailhead.salesforce.com/content/learn/modules/apex_integration_services/apex_integration_webservices

Are there any other examples i could refer to learn more on this subject ?
Best Answer chosen by Ab
Raj VakatiRaj Vakati
Refer this link

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest.htm
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotations_rest.htm
https://askforcetutorial.wordpress.com/2016/01/22/exposing-apex-classes-as-rest-web-services/
http://www.wadewegner.com/2013/03/creating-anonymous-rest-apis-with-salesforce-com/
http://www.proquestit.com/techies/salesforce-soap-vs-restful-web-services/
http://salesforce-walker.blogspot.com/2016/09/exposing-apex-class-as-rest-web-service.html
https://sfdcpanther.wordpress.com/2017/10/02/create-anonymous-salesforce-apex-rest-api-with-force-com-platform/

All Answers

Raj VakatiRaj Vakati
Refer this link

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest.htm
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotations_rest.htm
https://askforcetutorial.wordpress.com/2016/01/22/exposing-apex-classes-as-rest-web-services/
http://www.wadewegner.com/2013/03/creating-anonymous-rest-apis-with-salesforce-com/
http://www.proquestit.com/techies/salesforce-soap-vs-restful-web-services/
http://salesforce-walker.blogspot.com/2016/09/exposing-apex-class-as-rest-web-service.html
https://sfdcpanther.wordpress.com/2017/10/02/create-anonymous-salesforce-apex-rest-api-with-force-com-platform/
This was selected as the best answer
SandhyaSandhya (Salesforce Developers) 
Hi,

I would suggest you refer below salesforce document.

https://trailhead.salesforce.com/en/content/learn/modules/apex_integration_services/apex_integration_webservices
 
https://www.forcetalks.com/salesforce-topic/how-can-you-expose-an-apex-class-as-a-rest-webservice-in-salesforce (https://www.forcetalks.com/salesforce-topic/how-can-you-expose-an-apex-class-as-a-rest-webservice-in-salesforce/)
 
Best Regards,
Sandhya