Activity Forums Salesforce® Discussions What is a resource in Restful web services in Salesforce?

  • suniti

    Member
    July 12, 2018 at 10:55 am

    Hello Sanjana

    REST architecture treats every content as a resource. These resources can be Text Files, Html Pages, Images, Videos or Dynamic Business Data. REST Server simply provides access to resources and REST client accesses and modifies the resources. Here each resource is identified by URIs/ Global IDs. REST uses various representations to represent a resource where Text, JSON, XML. The most popular representations of resources are XML and JSON.

  • Parul

    Member
    September 15, 2018 at 4:32 am

    The @RestResource annotation to expose it as a REST resource. Similarly, add annotations to your methods to expose them through REST. For example, you can add the @HttpGet annotation to your method to expose it as a REST resource that can be called by an HTTP GET request.

     

    Thanks

  • shariq

    Member
    September 15, 2018 at 5:16 pm

    Hi,

    For more clarity -

    You can expose your Apex class and methods so that external applications can access your code and your application through the REST architecture. This is done by defining your Apex class with the @RestResource annotation to expose it as a REST resource. Similarly, add annotations to your methods to expose them through REST. For example, you can add the @HttpGet annotation to your method to expose it as a REST resource that can be called by an HTTP GET request.

    Six new annotations have been added that enable you to expose an Apex class as a RESTful Web service.@RestResource(urlMapping='/yourUrl')
    @HttpDelete
    @HttpGet
    @HttpPatch
    @HttpPost
    @HttpPut

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos