Can somebody explain what is a REST API wrapper?

Can somebody explain what is a REST API wrapper? How should it look like? When would we actually need it? Can we call them as DTO’s? Please give some usecases, examples or links.


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)

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

Source : Link , Question Author : SFDC Developer , Answer Author : techtrekker

Leave a Comment