Executing HTTP Requests

The http_request function allows developers to perform additional HTTP POST/GET requests during a page interaction, unlocking access to more data. By capturing these internal API calls, you can directly access key data in machine-readable formats like JSON, bypassing the need to parse HTML.

ParameterRequiredDescriptionValues

url

Required

The target URL for the HTTP request

String - URL

method

Optional Default = "GET"

The HTTP request method

Enum - "GET", "POST"

body

Optional

The Body for the HTTP request

String - body

headers

Optional

Additional headers required for the request (JSON)

Object - {"key" : "value"}

timeout

Optional

Controls the timeout if the internal HTTP request being performed.

Integer - milliseconds

curl -X POST 'https://api.webit.live/api/v1/realtime/web' \
--header 'Authorization: Basic <credential string>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://www.example.com",
    "render": true,
    "render_flow": [{
        "http_request": {
                "url": "https://www.example.com/api/data",
                "method": "POST",
                "headers": {...},
                "body": "...",
                "timeout": 5000
        }
    }]
}'

To perform HTTP request within a render flow, render must be set to true.

Last updated