Create Your First API REST Connection
Last updated 10/07/2024
Five's Connection Wizard is a fast and simple way to connect to an external API, as it allows you to interactively test and configure your REST data endpoints to ensure everything is correct before saving.
Five enables you to create and send API requests. You can send a request to an endpoint, retrieve data from a data source, or test an API's functionality.
An endpoint is a specific URL that serves as the entry point for interacting with a particular resource, for example, one specific product, or a set of resources, for example, a list of products. Endpoints are typically defined for each resource that the API exposes meaning each resource will have its own unique identifiable address.
In Five, all you need to do is simply create a new request and click the SEND button, the API response then becomes available in the lower panel of the Connection Wizard.
A request includes the URL of the API endpoint and a HTTP/S request method, the method indicates the action you want the API to perform. This brief introduction to Five's Connection Wizard will give you a basic overview on how to use the following methods.
Method | Description |
---|---|
GET | Retrieves data from an API |
POST | Sends new data to an API |
PUT | Updates existing data |
PATCH | Updates partially or completely existing data |
DELETE | Removes existing data |
Navigate to the Connection Wizard
1. Click Data in the menu.2. Click Connection Wizard in the sub-menu.
Add a Connection
1. Click the lookup icon in the Web Service field and select New.2. Type an ID in the WebService ID field.
3. Type a name in the Name field.
Create a GET Request
When only creating a GET request via a read list mapping, the records can only be viewed in a list.
1. Click the Read List Mapping tab.2. Paste your URL endpoint in the Get endpoint field.
3. After the URL address type
4. Click the SEND button.
5. Click the Field Mapping tab.
In the image below, you will see Five maps the fields from the REST data to a field in the connection data source. Five will try its best here to automatically perform the following tasks:
- Calculate the primary key field, however, you should ensure it is correct as this field is used to map a single record.
- Map the fields, however, you are free to add, edit, and delete fields here to suit your requirements.
Create a Single GET Request
When you create a single field mapping, you can view the entire data for a single record on a form in an application and have the ability, if configured, to update and delete records. The placeholder is provided by your API, which is typically the primary key field, and is used by Five to request a single record from the REST endpoint.
1. Click the Read Single Mapping tab.2. Paste your endpoint URL in the GET endpoint field.
3. Append the
12. In the Path Variables section, add an ID value in the Value field.
13. Click the Send button.
14. Click the Field Mapping tab.
Create a POST Request
15. Click the Create Single tab.
16. Paste your endpoint URL in the POST endpoint field.
You will need to add a single record that you can test with, this can either be copied from the Read Single Mapping page, or from your API documentation.
17. Click the Read Single Mapping tab.
18. Click the Params tab.
19. Click the Copy to Clipboard button for the entire record.
20. Click the Create Single mapping tab.
21. Click the Request Body tab.
22. Paste the JSON data in the Request Body.
23. Click the Send button.
Create a PUT Request
24. Click the Update Single tab.
25. Paste the endpoint URL and add the
26. In the Path Variables section, add an ID value in the Value field.
27. Click the Request Body tab.
28. Paste the JSON data in the Request Body.
29. Click the Send button.
Create a DELETE Request
30. Click the Delete Single tab.
31. Paste the endpoint URL in the DELETE endpoint field and add the
32. In the Path Variables section, add an ID value in the Value field.
33. Click the Send button.
34. Click the Save button in the REST Wizard app bar.
What Has Happened?
In this example, Five is acting as the client application and is communicating with an API server. When you clicked the Send button for the GET request the following happened.- Five sent a GET request to the server hosting the Fake Store API rest endpoint.
- The API server received the request, processed it, and returned a response.
- Five received the response and displayed it in the lower panel of the REST Wizard.
- By providing the endpoint and ID on the Read Single Mapping page, a record can be selected and viewed in your application.
- By providing the endpoint on the Create Single page, a new record can be created in your application.
- By providing the endpoint and ID on the Update Single and Delete Single pages, a record can be updated and deleted in your application.