Skip to content

Json Web Request

Nombre del elemento: Json Web Request (Json Web Request / External Services)

Categoría: Action Module

Description: Basic functionality that allows for name identification and selection of http verbs. Geared towards the consumption of external REST API services and receives Json structures as a response.

Functionality: Allows for the calling of external web services for consultation. Key-value fields belonging to the header structure can be specified, the HTTP verb oriented towards CRUD can be selected, body structures with the capacity to contain entities in text-type expressions can be controlled, default TO can be controlled, and all the main tools necessary for the exploitation of REST API web services and their interpretation. The result of the invocation is stored in an entity of string type, indicated by the user.

It is important to keep in mind the following:

  • Keep in mind that there are limits to the loading and handling of large volumes of data from the API, such as serialized images or multimedia in low-level formats. These limits can vary depending on the availability of resources on the platform. If you have any queries regarding high-resolution files and their serialization, please consult our team.

  • Keep in mind that very high overflow times (TO) will result in slow response times in Chat interactions.

Json Web Request Action Configuration Fields

[Name] Unique descriptor of the configuration box for identification purposes in the flow.

General Subset

[Invocation Mode] Defines the mode of operation for the communication technology implemented for the management of outgoing requests. (JREQUEST_INVOCATION_MODE)

Modes:

  • Normal (Default)

  • RelayWorker (Only for integrations with declared RelayWorker component). (Funciones Avanzada)

[HTTP Method] List of HTTP verbs for invocation, oriented to CRUD. (Method)

Modes:

  • GET

  • POST

  • PUT

  • HEAD

  • DELETE

  • PATCH

[URL] URL where the service to be consumed or managed is located, it accepts a text expression format and is also referred to as the destination service URL. (URLExpression)

-- Example of an expression that contains concatenated URL and entity parameters:

'http://api.openweathermap.org/data/2.5/weather?q=' + WeatherCityToFind + '&APPID=' + AppIDEnt |

[Headers] are a list of parameters defined as key/value pairs and make up external service configuration data. The key field allows the definition of plain values and the value field allows the entry of text expressions. Additionally, it should be noted that the content header has its own configuration section explained later. (Headers)

[Query Body] This field allows for the configuration of text expressions that make up the Body query, plain or JSON expressions are typically used, remember that they must be contained on a single line, you can use web tools to transform your JSON to this format or simply remove the carriage returns contained in the expression. (BodyExpression)

[Content Type Header] This field specifies, through a content type expression, the type of content to be transacted in the service. (ContentTypeExpression)

-- Sample Content-Type:

    'application/json'

[Maximum Wait Time] The maximum wait time (TO) field is defined by a text expression that configures in milliseconds how long Lynn should wait for a response from the service before considering the absence of a response as a handling error. This field is set by default to 100 seconds, which corresponds to its highest configuration value. It is recommended that you set the value according to best practices and response averages of your service. (TimeoutExpression)

-- Example:

If your service responds in a range of 1 to 3 seconds, set the value to 3000 ms (3s), which will ensure that any deviation does not result in a sense of degradation or data loss in the query.

[Redirection] This field accepts a text expression to configure a boolean value, allowing redirect responses from the service to be executed.(AllowAutoRedirectExpression)

[Query Result] This field hosts a text expression that defines the entity that will hold the yielded response from the consulted external service. Remember that since it is a text expression, the entity definition must be expressed as a literal enclosed in single quotes.(AllowAutoRedirectExpression)

[Error Handler] This dropdown box identifies the intention that will be activated in case of an error occurring in Json WebRequest. When an error overflow occurs, the Json_Request_Error entity will be loaded with the error detail if it is available.

Example of Json WebRequest Implementation

-- Example 1: Querying the time in my city

  • Data Inputs:

    HTTP Method: GET

    URL: 'http://worldtimeapi.org/api/timezone/' + REGION + '/' + CITY

    Content Type Header: 'application/json'

    Timeout: 3000

    Redirection: false

    Query Result: 'JsonWebRequestResult'

-- Result 1: Obtained in the entity to define in "Query Result"

Precondition: REGION -> America ; CITY -> Santiago

{  
    abbreviation: -03,  
    client_ip: 201.239.114.166,
    datetime: 2022-09-05T17:45:44.303664-03:00,  
    day_of_week: 1,
    day_of_year: 248,  
    dst: **true**,  
    dst_from: 2022-09-04T04:00:00+00:00,  
    dst_offset: 3600,  
    dst_until: 2023-04-02T03:00:00+00:00,  
    raw_offset: -14400,  
    timezone: America/Santiago, 
    unixtime: 1662410744, 
    utc_datetime: 2022-09-05T20:45:44.303664+00:00,  
    utc_offset: -03:00,
    week_number: 36 
}

Important: Use the JPath action to retrieve values from the Json structure to entities, or if you feel more comfortable or there are several fields of interest, you can also use the Code Block action for this same task.

Precondition: REGION -> America ; CITY -> Lima

{  
    abbreviation: -05,
    client_ip: 201.239.114.166,
    datetime: 2022-09-05T15:58:50.690683-05:00,
    day_of_week: 1,
    day_of_year: 248,  
    dst: **false**, 
    dst_from: **null**, 
    dst_offset: 0,
    dst_until: **null**, 
    raw_offset: -18000,  
    timezone: America/Lima, 
    unixtime: 1662411530, 
    utc_datetime: 2022-09-05T20:58:50.690683+00:00, 
    utc_offset: -05:00, 
    week_number: 36 
}

-- Example 2: Consultation of an external weather web service

  • Data inputs:

    HTTP method: GET

    URL: 'http://api.openweathermap.org/data/2.5/weather?q=' + WeatherCityToFind + '&APPID=' + AppIDEnt

Headers:

Key Value
Connection keep-alive

Header Content Type: 'application/json'

Maximum waiting time: 3000

Redirection: false

Query result: 'JsonWebRequestResult'

Precondition: AppIDEnt -> 2602bf1d32a55b83834f3710a13f84a7 (Obtenga su propio AppID en openweathermap.org); WeatherCityToFind -> Santiago

-- Result 2: obtained in the entity to be defined in "Query Result":

{  
    coord: 
    {  
        lon: -70.6483,  
        lat: -33.4569  
    },  
    weather: [  
    {  
        id: 804,  
        main: Clouds,  
        description: overcast clouds,  
        icon: 04d  
    }  
    ],  
    base: stations,  
    main: 
    {  
        temp: 288.35,  
        feels_like: 287.34,  
        temp_min: 283.84,  
        temp_max: 290.92,  
        pressure: 1024,  
        humidity: 54  
    },  
    visibility: 7000,  
    wind: 
    {  
        speed: 2.06,  
        deg: 260  
    },  
    clouds: 
    {  all: 100  },  
    dt: 1662053921,  
    sys: 
    {  
        type: 2,  
        id: 2075413,  
        country: CL,  
        sunrise: 1662030043,  
        sunset: 1662071095  
    },  
    timezone: -14400,  
    id: 3871336,  
    name: Santiago,  
    cod: 200 
}

Advanced Functions

-- RelayWorker Mode: This is intended for integrations with MS Relay technology to achieve more stable and private connections in cases of integrations against infrastructures that are in private networks.

Action Configuration Fields

Relay Worker Subset

The configuration fields of this subset are associated with the Relay connection. Additionally, you may need to establish some additional settings in your firewall security policies and the installation of AZ Relay client and its respective components. Please consult our sales representative if you want to learn more about the characteristics of these elements.

  • [URL] Connection URL for Relay link.

  • [Hybrid Connection] Name that defines the context of the Relay link.

  • [Access Policy Key Name] Identifier name for the set of access policies.

  • [Primary Key Value] Connection key name.