Web requests

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:

  • Connector "Web Location"
  • Action "Construct JSON" for transforming tabular data into JSON
  • Actions "Web Request" and "Iterate Web Request" for sending HTTP requests and obtaining responses
  • Action "Parse JSON" for transforming JSON into tabular data

If you're new to web APIs, we recommend reading this article first: Making your data better with web APIs.

Connector "Web Location"

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.

Web Location connector

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.

Action "Import from Web API"

The "Import from Web API" action is a simple way to pull data out of a web API. It can send only HTTP GET requests, and automatically recognizes and parses responses with a JSON or XML body.

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 shown 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 the tab "Headers". Headers "Content-Length" and "Accept" are inserted automatically, therefore they don't have to be specified explicitly.

action Import from Web API

Action "Web request"

The "Web request" action is a more advanced action than "Import from Web API". Besides GET, it can send HTTP requests of all the other types — POST, HEAD, PUT, etc., and configure a request body.

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. Header "Content-Length" is inserted automatically. Note that the action has a preview pane for previewing the raw HTTP request sent to the remote endpoint, and the response.

Action Web Request

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".

Unlike "Import from Web API", the "Web request" action doesn't parse the response automatically. The [Response-Body] column contains the request response and can be parsed using the "Parse JSON", or "Parse XML" actions (or any other action depending on response contents).

Parsing/constructing JSON

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:

  • Construct JSON (see example)
  • Parse JSON
  • Parse XML (available from v4.2)

Note that all these actions can work with multiple JSONs at once. For instance, "Construct JSON" can be configured to produce a column with a uniform JSON in each row. Similarly, "Parse JSON" can parse JSONs contained in each cell of a column, and automatically append the result into one table.

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.
Watch a relevant video in

Advanced topics

Action "Iterate Web request"

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 responses can be automatically concatenated into one table.

Action Iterate Web Request

"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.
Do you want to discuss this topic?
Join our community forum.