From Bright Pattern Documentation
Jump to: navigation, search
• 3.10 • 3.11 • 3.12 • 3.13 • 3.14 • 3.15 • 3.16 • 3.17 • 3.18

Fetch URL

This block fetches web content from a specified URL, using either the GET or POST requests. Both HTTP and HTTPS protocols are supported.

Note that a combination of POST and GET requests can be used to share data between scenarios.


Conditional Exits

  • Failed – Error occurred during the HTTP method execution. No error details are provided.
  • No Data - Executes if no data is returned in the body of the HTTP response. Applies only if the Recordset option is selected for the result storage (see below).


Settings

  • Title text - The name of the instance of the block.
  • URL to fetch – URL text field
  • Username - Text field, variable substitutions allowed
  • Password - Text field, variable substitutions allowed
  • URL parameters – Click add to define URL parameters; variables in the $(varname) format can be used
  • Request type – Choose the request type, GET (default) or POST
  • Content type – Type of data to be submitted; displayed only if request type POST is selected; select application/json for a JSON data structure or application/x-www-form-urlencoded for a URI-encoded data in the body of the message
  • Body – Data to be submitted in the JSON structure (i.e., when Content type is set to application/json); variable substitutions are allowed
  • Form parameters – Parameters and values submitted via the URI-encoded form (i.e., when Content type is set to application/x-www-form-urlencoded); click add to define a parameter-value pair; variable substitutions are allowed
  • Result is stored in – Choose where the received content will be stored.
    • Select Variable if the entire response body is to be stored as a string in the specified scenario variable. The body is not parsed. If there is no data in the body, the variable will be set to an empty string. Thus, the No Data conditional exist does not apply to this storage option.
    • Select Recordset if a JSON data structure conforming to the format specified below is expected in the response body. Provide the recordset name: the JSON data structure will be parsed and stored it in the recordset with the specified name. Use the Get Next Record block to get records from the recordset.


In order to be parsed successfully into the specified recordset, the JSON data structure expected in the response must have the following format:

The values are stored in variables <recordset_name>.<varname>, for example RS.varname1.

The number of returned records is stored in variable <recordset_name>.__count__, for example RS.__count__. (Note the double underscores in front and after count; they are used to reduce the chance of confusing the name of this variable with a column name in a recordset.)


In all cases, the code and the body of the received HTTP response will be stored in local variables $(integrationResultCode) and $(integrationResultBody) respectively. For troubleshooting purposes, use the EMail or Internal Message block to obtain content of responses indicating a failed attempt. For more information, see description of variable $(integrationResultBody).


For backward compatibility reasons, the code and the body of the received HTTP response are also be stored in local variables $(fetchURLResultCode) and $(fetchURLResultBody).

The possible values of the $(fetchURLResultCode) variable are:

  • 0: Successful response (response returned 200 OK)

  • -1: 200 OK response, but unable to parse the body into recordset

  • -2: 200 OK response, but body length exceeds 50Kb

  • -3: Unable to connect to HTTP server or other connection errors

  • Other: Actual non-200 response code

      < Previous | Next >
      < Previous | Next >