Nowadays, more and more data in external systems and cloud applications becomes available via web (REST) APIs. With EasyMorph you can send highly configurable web (HTTP) requests in order to retrieve data, submit new and change existing data, and trigger processes via web APIs. For this, EasyMorph provides:
If you're new to web APIs, we recommend reading this article first: Making your data better with web APIs
The "Web location" connector specifies common properties of a web API, such as base URL or proxy settings. It also allows specifying URL parameters and request headers that must be included with every web request sent using this connector. Such URL parameters and/or headers can be used for specifying API keys and secret tokens required for authentication.
Under the hood, the connector also contains a cookie container which is passed from request to request. Cookies in the container are set and retrieved automatically by each web request.
The "Web request" action sends an HTTP request. Note that the final request URL is concatenated from the base URL specified in the "Web Location" connector, and the URL path specified in the action. For instance, for the action show in the screenshot below the final request URL is https://community.easymorph.com/posts.json assuming that it uses the "Web Location" connector depicted above.
Request headers can be configured in tab "Headers". Header "Content-Length" is calculated automatically therefore it doesn't have to be specified. For HTTP methods that require a request body (e.g. POST), there are a few ways to construct the body such as simple JSON, or web-form emulation. Note that the action has a preview pane that allows to preview the raw HTTP request sent to the remote endpoint, and the response.
As per action settings, the HTTP response can be ignored, or captured, or its contents (body) can be saved into a file. See this web-help article for detailed documentation of configuring the "Web request" action: Action "Web Request"
Web APIs typically operate with data in hierarchical formats such as JSON or XML, while EasyMorph is optimized for tabular datasets. To facilitate transition from JSON/XML to tables and back EasyMorph provides the following actions:
Besides that, there is a number of functions that help detect and extract data from JSON/XML in expressions:
Example: Every EasyMorph installation comes with preinstalled example "Community users" which demonstrates retrieving data from a web (REST) API and parsing response JSONs into tabular datasets.
To simplify sending multiple uniform web requests (e.g. when submitting/modifying data in a remote system), EasyMorph provides the "Iterate web request" action which sends one request per each row of the input dataset. The action is very similar to the regular "Web request" action with the addition of the capability to configure requests (paths, headers, etc.) using column values. The reponses can be automatically concatenated into one table.
"Iterate web request" combines well with actions "Parse JSON" and "Construct JSON" because they allow processing/creating multiple JSON objects stored in a column. The action also has a preview mode.
Example: Every EasyMorph installation comes with preinstalled example "Community users" which demonstrates retrieving data using the "Iterate web request" action.Read next: PowerShell scripting