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
vishal gupta 47vishal gupta 47 

REST API Wrapper

Can somebody explain what is a REST API Wrapper with a use case.
Best Answer chosen by vishal gupta 47
NagendraNagendra (Salesforce Developers) 
Hi Vishal,

Please find the difference between a normal wrapper and a REST API wrapper.

Wrapper Class : A Wrapper Class (or the Wrapper Pattern) is where you declare a Class as a container for an sObject to extend the functionality only for display or processing purposes (i.e. you don't intend for that attribute to be persisted) - the classic example is a checkbox to select records. I would say that a DTO is a slightly dumbed down version of such a wrapper (used in conventional OOP to pass structured data between the layers)

REST API Wrapper : A REST API wrapper is something slightly different. Salesforce exposes a REST API and if you were to invoke that say from C#, you would have to perform a set of common steps such as login, query, etc. To make this available in C# by abstracting the innards of the actual REST calls to salesforce and exposing only the developer relevant detail, you could write a rest wrapper which performs these commonly used functions - creates requests, parses responses, etc.

For use cases please refer to the below link.
https://www.godaddy.com/garage/webpro/wordpress/3-practical-use-cases-wp-rest-api/

Please let me know if you have any queries further.

Best Regards,
Nagendra.P

 

All Answers

Vasani ParthVasani Parth
A Wrapper Class (https://developer.salesforce.com/page/Wrapper_Class) (or the Wrapper Pattern) is where you declare a Class as a container for an sObject to extend the functionality only for display or processing purposes (i.e. you don't intend for that attribute to be persisted) - the classic example is a checkbox to select records. I would say that a DTO is a slightly dumbed down version of such a wrapper (used in conventional OOP to pass structured data between the layers)

A REST Api wrapper is something slightly different. Salesforce exposes a REST Api and if you were to invoke that say from C#, you would have to perform a set of common steps such as login, query, etc. To make this available in C# by abstracting the innards of the actual REST calls to salesforce and exposing only the developer relevant detail, you could write a rest wrapper which performs these commonly used functions - creates requests, parses responses, etc
NagendraNagendra (Salesforce Developers) 
Hi Vishal,

Please find the difference between a normal wrapper and a REST API wrapper.

Wrapper Class : A Wrapper Class (or the Wrapper Pattern) is where you declare a Class as a container for an sObject to extend the functionality only for display or processing purposes (i.e. you don't intend for that attribute to be persisted) - the classic example is a checkbox to select records. I would say that a DTO is a slightly dumbed down version of such a wrapper (used in conventional OOP to pass structured data between the layers)

REST API Wrapper : A REST API wrapper is something slightly different. Salesforce exposes a REST API and if you were to invoke that say from C#, you would have to perform a set of common steps such as login, query, etc. To make this available in C# by abstracting the innards of the actual REST calls to salesforce and exposing only the developer relevant detail, you could write a rest wrapper which performs these commonly used functions - creates requests, parses responses, etc.

For use cases please refer to the below link.
https://www.godaddy.com/garage/webpro/wordpress/3-practical-use-cases-wp-rest-api/

Please let me know if you have any queries further.

Best Regards,
Nagendra.P

 
This was selected as the best answer