Skip to content

JsonRequestFromPostmanFile

Nombre del elemento: JsonRequestFromPostmanFile (Json web request from postman file)

Categoría: Action module

Descripción: Basic functionality, allows identification of name and selection of http verbs. Oriented to the consumption of external REST API services and receives Json structures as a response, uses an import structure extracted from Postman to configure call parameters.

Funcionalidad: Allows the call of external web services for querying, the configurations come from an import file extracted from Postman in which all necessary configurations for the call are delegated, this structure can be modified to include text expressions and entities, however, this action is intended for calls that do not require large changes in input parameters, the result of the invocation is stored in a string-type entity indicated by the user.

It is important to consider the following:

  • You must take into account that there are limits to loading and handling large volumes of data from the API, for example: serialized images or multimedia in low-level formats, these limits may vary depending on the availability of platform resources. If you have any questions about high-resolution files and their serialization, please consult our team.

  • You must take into account that very high overflow times (TO) will result in slow response in chat interactions..

  • For this functionality, the use of the Postman program is required with the ability to export collections, from there the required structures for configuration in this action box will be taken.

Configuration fields of JsonRequestFromPostmanFile action

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

General Subset

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

Modes:

  • Normal (Default)

  • RelayWorker (Only for integrations with declared RelayWorker component)(Advanced Functions)

[Postman Json Extract] This field is used to enter the Postman extract that represents the outgoing request, the field accepts text expressions so you can manipulate the parameters by entering it as an expression. (JSON_REQUEST_EXPRESSION)

-- Example of extraction from Postman Collection:

Select the target collection in Postman that contains the call to the desired service, and press collection options and then export, save the file locally, and open its content in a text editor. You will obtain a structure similar to:

{  
    info: 
    {  
        _postman_id: 8b87921f-63c3-4cbf-b86c-8e7412e3cbbe,  
        name: TOEXPORT,  
        schema: https://schema.getpostman.com/json/collection/v2.1.0/collection.json,  
        _exporter_id: 3438743  
    },  
    item: 
    [  
        {  
            name: EXPORTS FROM POSTMAN,  
            item: 
                [  
                    {  
                        name: http://worldtimeapi.org/api/timezone/America/lima,  
                        request: 
                        {  
                            method: GET,  
                            header: [],  
                            url: 
                            {  
                                raw: http://worldtimeapi.org/api/timezone/America/lima,  
                                protocol: http,  
                                host: 
                                [  
                                    worldtimeapi,  
                                    org  
                                ],  
                                path: 
                                [  
                                    api,  
                                    timezone,  
                                    America,  
                                    lima  
                                ]  
                            }  
                        }, 
                        response: []  
                    } 
                ]  
        }  
    ] 
}

Observe within the structure of the collection the "name" section that corresponds to the folder containing the call, and the contents of this are listed in an array "item". Within this array, you can identify the parameters of each individual call. Segregate and copy the corresponding structure for the call of interest as shown below.

{  
    name: http://worldtimeapi.org/api/timezone/America/lima,  
    request:
    {  
        method: GET,  
        header: [],  
        url: 
        {  
            raw: http://worldtimeapi.org/api/timezone/America/lima,  
            protocol: http,  
            host: 
            [  
                worldtimeapi,  
                org  
            ],  
            path: 
            [ 
                api,  
                timezone,  
                America, 
                lima  
            ]  
        }  
    }, 
    response: [] 
}

This will be the structure that will be included within the text expression of the "Postman Json Extract" field.

[Maximum Waiting Time] The maximum waiting time (TO) field is defined by a text expression that allows you to configure in milliseconds how long Lynn should wait for the service response 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 to set the value according to best practices and response averages of your service.. (TIMEOUT_EXPRESSION)

[Query Result] This field hosts a text expression that defines the entity that will house the transferred response from the external service queried, remember that being an expression the entity definition must be expressed as a literal between single quotes. .(OUTPUT_RESULT_ENTITY)

[Error Handler] Selection box where the intention that will be activated in case of an error in Json Request from Postman is identified. When an error overflow is executed, the Json_Request_From_Postman_Error entity will be loaded with the error detail if it is available. (INTENT_TO_EXECUTE_ON_ERROR)

Example of JsonRequestFromPostmanFile implementation

Example 1: Querying the time in my city

-- Input data:

Extract from Postman Json:

{  
    request: 
    {  
        method: GET,  
        header: [],  
        url: 
        {  
            raw: http://worldtimeapi.org/api/timezone/'+ REGION +'/' +CITY + ',  
            protocol: http,  
            host: [ worldtimeapi,  org],  
            path: [  api,  timezone,  '+ REGION +',  ' +CITY + '  ]  
        } 
    },  
    response: [] 
}



    (Notice the inclusion of entities in the structure)

Maximum waiting time: 1000

Resultado de consulta: 'JsonWebRequestResult'

Result 1 obtained in the entity to be defined in "Query result"

Precondition: REGION -> America ; CITY -> Santiago

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

Precondition: REGION -> America ; CITY -> Lima

{
    abbreviation:-03,
    client_ip:20.201.25.83,
    datetime:2022-09-06T12:08:00.728505-03:00,
    day_of_week:2,
    day_of_year:249,
    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:1662476880,
    utc_datetime:2022-09-06T15:08:00.728505+00:00,
    utc_offset:-03:00,
    week_number:36
}

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 on private networks.

Action Configuration Fields

Relay Worker Subset

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

[URL] Connection URL to Relay link.

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

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

[Primary Key Value] Connection key name.