User Tools

Site Tools


transformations:webrequest

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
transformations:webrequest [2019/10/31 07:48] – [Tab Body] dmitrytransformations:webrequest [2020/11/28 06:07] – [See also] dmitry
Line 3: Line 3:
 Category: Workflow / External 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.+Sends a single 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. Supports all HTTP methods - GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, TRACE, PATCH.
Line 24: Line 24:
 | %%https://example.com/api/v3%%  | orders  | year  | 2019  | %%https://example.com/api/v3/orders?year=2019%% | | %%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.
 ====Request body==== ====Request body====
 The request body can be specified in one of the following ways: The request body can be specified in one of the following ways:
Line 77: Line 78:
 The request body is read from the specified file and inserted verbatim. The request body is read from the specified file and inserted verbatim.
  
-====Headers==== +====Request headers==== 
-Additional request headers. Header names and values can be specified either explicitly or using parameters.+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. 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.
 +====Response====
 +
 +There are 3 modes how a response would be processed in the Web Request action:
 +
 +===Fail if HTTP error, otherwise ignore===
 +In this case, if the response status is not an error (i.e. HTTP status codes 4xx or 5xx) then the response will be ignored. This is basically "fire-and-forget" mode that is intended for submitting data and updates to remote endpoints.
 +
 +===Return response as the action result===
 +In this mode, the response (error or not) is always received and transformed into a 1-row dataset in EasyMorph. The column names in such dataset correspond to response body, response status, and response headers (one column per each header).
 +
 +===Fail if HTTP error, otherwise save response body into file===
 +In this case, if the response status is not an error (i.e. HTTP status codes 4xx or 5xx) then the response body (only body!) will be saved verbatim into the specified file.
 +
 +====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 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 **
 +
 +  * [[transformations:iteratewebrequest|Iterate Web Request]]
 +  * [[connectors:weblocation|Connector "Web Location"]]
transformations/webrequest.txt · Last modified: 2023/04/21 03:52 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki