Your script can make outbound HTTP requests using popular HTTP packages for your given language.

Making outbound HTTP requests

HTTP support is only available in our JavaScript and Python runtimes.

Code you run with the execute code endpoint can make outbound HTTP requests. By default all HTTP requests are blocked. Configure allowed hosts and (optionally) associated credentials with the http request parameter.

Allowed host patterns

Values of the host parameter within an allowed HTTP request configuration support two types of pattern matching.

  • * matches all hosts
  • *.example.com matches all subdomains of example.com, but not example.com itself

Adding authentication credentials

Rather than exposing HTTP authentication credentials to your code, you can pass credentials to Riza directly and we’ll add them to outbound HTTP requests. This ensures credentials can’t be stolen by malicious code.

Using basic authentication

{
    "http": {
        "allow": [{
            "host": "example.com",
            "auth": {
                "basic": {
                    "user_id": "johny.appleseed",
                    "password": "<password>",
                },
            }
        }]
    }
}

Using bearer authentication

{
    "http": {
        "allow": [{
            "host": "example.com",
            "auth": {
                "bearer": {
                    "token": "<api token>",
                },
            }
        }]
    }
}

Using header authentication

{
    "http": {
        "allow": [{
            "host": "example.com",
            "auth": {
                "header": {
                    "name": "X-Example-Api-Key",
                    "token": "<api key>",
                },
            }
        }]
    }
}

Using query parameters

{
    "http": {
        "allow": [{
            "host": "example.com"
            "auth": {
                "query": {
                    "key": "apikey",
                    "token": "<api key>",
                },
            }
        }]
    }
}