previous topic: Add a module
To consume a REST services, drop a REST Operation activity on the flow. You can do this by selecting the REST Operation activity in the Codolex palette, and drag this on the line between the start of the flow (the green dot) and the end of the flow (the red dot).
Next, double click on the REST Operation activity in the flow.
For this first example, we just use the following URL to retrieve the JSON from the Rest API:
https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam
Copy and paste this URL in the URL edit box. Next, click the three dots next to the edit box, and click stringify (alternatively, use CTRL+D). In this example, we need to make sure the URL's content field content is a string so we need to add quotation marks around it to specify this as actual text. It is also possible to use a variable in the URL field and it that case, no quotation marks would be needed.
Change the name of the result text to JSONResult, and click Save.
If you want, you can now check the code by clicking the Preview button at the top of the flow screen to see the code that Codolex will generate.
To show the result of this call, let’s drag and drop a ShowDialog activity after the REST Operation activity, open it, put JSONResult as the text and set the message type to Information.
The next topic will show how to use the flow in our delphi project