Testing endpoints using Workbench
In Chapter 12, Using Platform Events, we saw how we can publish platform events through the Salesforce REST API using the Workbench tool at https://workbench.developerforce.com/restExplorer.php. When we define a new Apex REST API, we can access and test the API using the same REST Explorer tool.
Any custom Apex REST endpoint is exposed through the /services/apexrest/yourURLMapping
endpoint. For our hospital endpoint, this is /services/apexrest/hospital
.
In the following screenshot, you can see how I have entered this URL with the ACME123
resource identifier, and run a GET
request to retrieve the hospital record with Hospital_Ref_Code__c
set to ACME123
:
Figure 14.4 – Running a GET request against a custom endpoint using the Workbench REST Explorer
You can see in the screenshot that the REST Explorer formats the response from the API. However, you can click the Show Raw Response link and the raw response from...