- Postman is an API collaboration platform used by over 17 million people. While Postman does much more, it’s most frequently used as an API client. Developers use Postman to send API calls and inspect what comes back.
- Review below Postman/RestService demo video -
- Postman Trailhead Module(web versio) - https://trailhead.salesforce.com/en/content/learn/modules/postman-api-client
- Download Postman(desktop agent) - https://www.postman.com/downloads/
Apps that are hosted on a secure server use the web server
authentication flow. 1)To get the access token, follow the below steps -https://login.salesforce.com/services/oauth2/token.
2) To extract the record, do a get request and in headers section add
Authorization
3) To do a Post request through workbench, follow the below steps -
Apex Class Code -
@RestResource(urlMapping='/api/Account/*')global class MyFirstRestAPIClass { @HttpGet global static Account doGet() { RestRequest req = RestContext.request; RestResponse res = RestContext.response; String AccNumber = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1); Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE AccountNumber = '12345' ]; return result; } @HttpDelete global static void doDelete() { RestRequest req = RestContext.request; RestResponse res = RestContext.response; String AccNumber = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1); Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE AccountNumber = '12345' ]; delete result; } @HttpPost global static String doPost(String name,String phone,String AccountNumber ) { Account acc = new Account(); acc.name= name; acc.AccountNumber =AccountNumber ; insert acc; return acc.id; } }
To review the limits
/Services/data/v50.0/limits