HTTP Functions

  • fn.request_get: Return in JSON format the response of an HTTP request. The HTTP request must start with http://localhost

Example request:

{{ fn.request_get  http://localhost/api/data/Countries/properties }}

The output can be assigned to a variable so that properties can be referenced.

Example with output snippet:

http://localhost/api/data/Countries/properties
{
    "meta": {
        "query": "/api/data/Countries/properties/?hierarchy=[hierarchy]&format=json"
    },
    "choices": [
        [
            "cli_on_prefix",
            "cli_on_prefix"
        ],
        [
            "country_name",
            "country_name"
        ],
        [
...

Example of instance output with GET request for an instance with [pkid]:

http://localhost/api/data/Countries/54e1de60edec65160652e402
...

  ],
     "business_key": {
         "hierarchy": true,
         "unique": [
             "country_name",
             "iso_country_code"
         ]
     },
     "tagged_versions": []
 },
 "data": {
     "iso_country_code": "MEX",
      "pstn_access_prefix": "9",
      "pkid": "54e1de60edec65160652e403",
      "default_user_locale": "English United States",
      "network_locale": "United States",
      "standard_access_prefix": "0",
      "international_access_prefix": "00",
      "country_name": "Mexico",
      "international_dial_code": "52",
      "emergency_access_prefix": "066",
      "national_trunk_prefix": "01"
     }
  • fn.perform_http_get: Given a URL parameter and optionally username and password parameters, return in HTTP status code of the HTTP request.

    Example request:

    {{ fn.perform_http_get  http://<hostname> }}
    

    Example request with additional parameters:

    {{ fn.perform_http_get  http://<hostname> <username> <password>}}
    

    Example output:

    200
    

    If the HTTP request raises an error (for example: not found, connection, timeout, and so on), this error will be returned.