Table of Contents

IMPORT FROM WEB API

Category: Import / API


Description

This action sends a GET request to a web API and automatically parses the JSON/XML response into a tabular dataset. The request is sent to a Web Location connector or to a base URL specified in the action.


Use cases

This action is intended for interactions with REST APIs, cloud applications, and websites.


Action settings

Setting Description
Connector*/Base URL1Select or create a Web Location connector, or enter the base URL for the request. Select between "Connector" and
"Base URL" using the selector to the left of the input field.
Path1See "Path setting", below.
URL parameters1Insert parameters into the URL. See "URL parameters", below, for details.
Headers1See "Headers settings", below.
OptionsSelect the parsing mode for JSON responses. Options: Dense, Sparse (see "Parsing modes" below).

* Setting can be specified using a parameter.
1 Setting can be specified using a parameter or the first value of a column.


Path setting

The URL path is appended to the endpoint URL specified in the Web Location connector. EasyMorph parameters can be inserted into the path using curly braces if needed. Alternatively, the entire path can be specified with a parameter.

Examples:

Web Location endpoint Web Request path Actual HTTP request URL Notes
https://example.com/api/v3 products https://example.com/api/v3/products
https://example.com/api/v3 product/123 https://example.com/api/v3/product/123
https://example.com/api/v3 product/{ProductID} https://example.com/api/v3/product/123 Assuming {Product ID} = 123


URL parameters

URL parameters can be specified as name-value pairs. They will be encoded and appended as a URL query. Value can be omitted, if needed. In this case, only the name will be appended to the URL query.

Example:

Web Location endpoint Web Request path Name Value Actual HTTP request URL
https://example.com/api/v3 orders year 2019 https://example.com/api/v3/orders?year=2019

If a Web Location connector has permanent URL parameters specified they will be appended to all requests that are made using the connector. This can be used for scenarios where all requests should have an API key or secret specified.


Headers settings

Additional request headers can be specified. Header names and values can be specified either explicitly or using parameters.

Note that header Content-Length is calculated and added to every request automatically.

If a Web Location connector has permanent headers specified they will be added to all requests that are made using the connector. This can be used for scenarios where all requests should have an API key or secret.


Parsing modes (JSON)

Mode Description
DenseDefault option. Properties of nested objects are placed in the same row as their parent's properties, and a new row is created only for each array item. See this example.
SparseEach nested object gets its own row, and an empty column is added for each array, so the result has more rows and more empty cells.


Remarks

Cookies

Currently, there is no way to set HTTP cookies explicitly in the Web Request action. Under the hood, all cookies that come with responses to web requests are automatically stored in a cookie container that exists only during project execution. Cookies from the container are automatically appended to outgoing requests made using the same Web Location connector. If a project workflow includes calls/iterations, the cookie container is passed to called/iterated modules or projects which in turn can add new cookies to it. This can be used for cookie-based web sessions.

When project execution is finished, the cookie container is discarded. No cookies are stored in the project or Web Location connector.

When developing workflows with web requests it may be necessary to re-run parts of workflows. In this case, it is recommended to always start from the Web Request actions that do authentication so that the session cookies can be set under the hood.


See also