Realtime

Realtime is a synchronous integration method. It requires keeping the connection open until the job is finished successfully or returns an error.

Job Submission

Endpoint

The Realtime API endpoint for job submission is:

POST https://realtime.oxylabs.io/v1/queries

Input

Provide the job parameters in a JSON payload as shown in the examples below. Python and PHP examples include comments for clarity.

curl --user "USERNAME:PASSWORD" \
'https://realtime.oxylabs.io/v1/queries' \
-H "Content-Type: application/json" \
-d '{"source": "ENTER_SOURCE_HERE", "url": "https://example.com", "geo_location": "United States"}'

Output

Realtime API supports these result types in the output:

  • HTML: The raw HTML content scraped from the target webpage;

  • JSON: Structured data parsed from the HTML content, formatted in JSON format;

  • PNG: Base64-encoded screenshot of the rendered page in PNG format.

This table explains the default and other available result types based on the parameters included in the payload of the API request.

Render parameter
Parse parameter
Default output
Available output

x

x

html

html

html

x

html

html

png

x

png

html, png

x

true

json

html, json

html

true

json

html, json

png

true

png

html, json, png

Realtime API always returns the default output. To get other available outputs from the same realtime job, use Push-Pull endpoints with that job ID. Note that the job ID can be found in the headers of each realtime response as well as within the response body.

Output example:

{
  "results": [
    {
      "content": "<html>
      CONTENT
      </html>"
      "created_at": "2019-10-01 00:00:01",
      "updated_at": "2019-10-01 00:00:15",
      "id": null,
      "page": 1,
      "url": "https://www.example.com/",
      "job_id": "12345678900987654321",
      "status_code": 200
    }
  ]
}

Last updated