User Tools

Site Tools


transformations:webrequest

This is an old revision of the document!


Web Request

Category: Workflow / External

Sends an HTTP request to a web server and receives a response. Intended for interactions with REST APIs, cloud applications and websites. Requires a configured Web Location connector.

Supports all HTTP methods - GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, TRACE, PATCH.

To simplify development and debugging, the action has a preview pane that shows the raw HTTP request that would be sent as well as a response preview.

Path

The URL path is appended to the endpoint URL specified in 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 URL query. Value can be omitted, in needed. In this case, only the name will be appended to the URL query.

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

Request body

The request body can be specified in one of the following ways:

JSON

This body type is suitable for sending simple JSONs. The JSON object is constructed from a list of name-value pairs. Both name and value can be specified with a parameter. If the value itself is a JSON object/array it's inserted verbatim thus allow object nesting.

When this body type is selected header "Content-Type:application/json" is set automatically.

Example:

Name Value
Country CA
ProvinceON
Name EasyMorph
Incorporated 2014
Tags ["ETL", "analytics", "dataprep", "automation"]

Resulting request body (JSON):

{
  "Country":"CA",
  "Province":"ON",
  "Name":"EasyMorph",
  "Incorporated":2014,
  "Tags":["ETL", "analytics", "dataprep", "automation"]
}

Text

This body type specifies body as a free-form text with parameters inserted, if needed.

Form

This body type is equivalent to submitting a web-form. Name-value pairs are encoded as if it was a web-form.

Header Content-Type is automatically set to "application/x-www-form-urlencoded".

Example:

Name Value
Country CA
ProvinceON
Name EasyMorph
Incorporated 2014

Resulting request body:

Country=CA&Province=ON&Name=EasyMorph&Incorporated=2014

File

The request body is read from the specified file and inserted verbatim.

Headers

Additional request headers. 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.

transformations/webrequest.1572522494.txt.gz · Last modified: 2019/10/31 07:48 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki