As various web APIs become more widespread we keep getting more and more questions how to access this or that API from EasyMorph. We will be addressing this need with a number of new actions in one of the nearest releases. Until then, as a workaround it is possible to use the PowerShell action with a short script for sending web requests and parsing JSON responses. Here is an example:
The example sends a GET request to a free web-service to receive a somewhat recent USD/CAD exchange rate. The response comes in as JSON that looks like {"USD_CAD":{"val":1.33933}}. We’re using PowerShell’s command ConvertFrom-Json to parse it and make it an object, which property val is accessed using Select -expand. The value of val is captured back into EasyMorph.
Here is the full example. To make it a bit more interesting, the source and target currencies are defined as EasyMorph parameters and used in the script.