Running REST API through Workbench in Salesforce involves the following steps:
1. Open Workbench by following the provided link: Workbench
2. Log in to your Salesforce Org and grant access.
3. Navigate to Utilities > REST Explorer.
Perform a GET Request:
- Choose the desired REST API version.
- Set the HTTP method to GET.
- Enter the REST API endpoint in the "URI" field.
- Click "Execute" to run the GET request.
- /services/data/v58.0/: Specifies the Salesforce API version.
- /sobjects/: Indicates that you are working with Salesforce objects.
- Account/: Specifies the Salesforce object type (in this case, the Account object).
- 0015h00001NSxfFAAT: The unique Salesforce ID of the specific Account record you want to retrieve.
Perform a POST Request:
- Set the HTTP method to POST.
- Enter the REST API endpoint in the "URI" field.
- Provide the required request headers and body.
- Click "Execute" to run the POST request.
/services/data/v58.0/sobjects/Account/
Json
{
"name": "John",
"position__c": "Engineer",
"department__c": "IT"
}
Example:
- name: This field stores the name of the individual, which is "John Doe" in this example.
- position__c: Indicates the job position or title of the person, which is "Software Engineer."
- department__C: Specifies the department in which the person works, and it's set to "IT."