Each time you need to send or receive data using an API – you will make a request. With an API added to your project, you will see a drop-down list in the API tab on the right of the editor showing the available endpoints. To use a request in a page:
- Add a request to the page by selecting an endpoint.
- Add an Action to specify when the request should run.
- Open the request to connect parameters and responses to your UI and functionality.
Dropsource supports a variety of request types for retrieving, adding, updating, and deleting data, including GET, POST, PUT, PATCH, and DELETE.
Select one from the list and click Add to use it in a particular page. Once added the endpoint will appear in the API tab as a request you can configure.
Click a request to open it. From here you can specify parameters to send, display responses in the page, and add processing to execute when the response is received.
If you decide not to use a request in a particular page, click to open it, then use the Delete button.
Once you have an endpoint added to a page in your app, you need to specify when you want the request to run. This will be when an Event occurs in your app, such as the user tapping a button, or the page loading. You will typically run the request on user interaction if the parameters include data entered by the user, and on page load if the request has all of the information it needs to run straight away.
Select the relevant Element or page (in the Canvas or Element Tree) and open Properties > Events. Add an Action to your chosen Event, for example Tapped or Page Loaded.
Add the Run API Request Action, selecting the endpoint.
If you’re having problems with a request you’ve added to a Dropsource app, check out our troubleshooting guide.