If you need more than one API user for your account, please contact ourcustomer support or message our 24/7 live chat support.
Content-type. When submitting jobs, always add this header:
Content-Type: application/json
Payload:
source - This parameter sets the scraper that will be used to process your request.
URL or query - Provide the URL or query for the type of page you want to scrape. Refer to the table below and the corresponding target sub-pages for detailed guidance on when to use each parameter.
Additional parameters: Optionally, you can include additional parameters such as geo_location, user_agent_type, parse, render and more to customize your scraping request.
If you need more than one API user for your account, please contact ourcustomer support or message our 24/7 live chat support.
Content-type. When submitting jobs, always add this header:
Content-Type: application/json
Payload:
source - This parameter sets the scraper that will be used to process your request.
URL or query - Provide the URL or query for the type of page you want to scrape. Refer to the table below and the corresponding target sub-pages for detailed guidance on when to use each parameter.
Additional parameters: Optionally, you can include additional parameters such as geo_location, user_agent_type, parse, and more to customize your scraping request.
Upon submitting a request, you will promptly receive a JSON response containing all job details, including job parameters, job ID, and URLs for downloading job results:
GET https://data.oxylabs.io/v1/queries/{job_id}/results
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=raw
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=parsed
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=png
If you need more than one API user for your account, please contact ourcustomer support or message our 24/7 live chat support.
Content-type. When submitting jobs, always add this header:
Content-Type: application/json
Payload:
source - This parameter sets the scraper that will be used to process your request.
URL or query - Provide the URL or query for the type of page you want to scrape. Refer to the table below and the corresponding target sub-pages for detailed guidance on when to use each parameter.
Additional parameters: Optionally, you can include additional parameters such as geo_location, user_agent_type, parse, render and more to customize your scraping request.
If you need more than one API user for your account, please contact ourcustomer support or message our 24/7 live chat support.
Content-type. When submitting jobs, always add this header:
Content-Type: application/json
Payload:
source - This parameter sets the scraper that will be used to process your request.
URL or query - Provide the URL or query for the type of page you want to scrape. Refer to the table below and the corresponding target sub-pages for detailed guidance on when to use each parameter.
Additional parameters: Optionally, you can include additional parameters such as geo_location, user_agent_type, parse, and more to customize your scraping request.
Upon submitting a request, you will promptly receive a JSON response containing all job details, including job parameters, job ID, and URLs for downloading job results:
GET https://data.oxylabs.io/v1/queries/{job_id}/results
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=raw
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=parsed
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=pn
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'universal',
'url': 'https://sandbox.oxylabs.io/',
# 'render': 'html', # If page type requires
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('USERNAME', 'PASSWORD'), # Your credentials go here
json=payload,
)
# Instead of response with job status and results url, this will return the
# JSON response with results.
pprint(response.json())
# The whole string you submit has to be URL-encoded.
https://realtime.oxylabs.io/v1/queries?source=universal&url=https%3A%2F%2Fsandbox.oxylabs.io%2F&access_token=12345abcde
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
namespace OxyApi
{
class Program
{
static async Task Main()
{
const string Username = "USERNAME";
const string Password = "PASSWORD";
var parameters = new {
source = "universal",
url = "https://sandbox.oxylabs.io/",
// render = "html", // If page type requires
};
var client = new HttpClient();
Uri baseUri = new Uri("https://realtime.oxylabs.io");
client.BaseAddress = baseUri;
var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/v1/queries");
requestMessage.Content = JsonContent.Create(parameters);
var authenticationString = $"{Username}:{Password}";
var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(authenticationString));
requestMessage.Headers.Add("Authorization", "Basic " + base64EncodedAuthenticationString);
var response = await client.SendAsync(requestMessage);
var contents = await response.Content.ReadAsStringAsync();
Console.WriteLine(contents);
}
}
}
package org.example;
import okhttp3.*;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;
public class Main implements Runnable {
private static final String AUTHORIZATION_HEADER = "Authorization";
public static final String USERNAME = "USERNAME";
public static final String PASSWORD = "PASSWORD";
public void run() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("source", "universal");
jsonObject.put("url", "https://sandbox.oxylabs.io/");
Authenticator authenticator = (route, response) -> {
String credential = Credentials.basic(USERNAME, PASSWORD);
return response
.request()
.newBuilder()
.header(AUTHORIZATION_HEADER, credential)
.build();
};
var client = new OkHttpClient.Builder()
.authenticator(authenticator)
.readTimeout(180, TimeUnit.SECONDS)
.build();
var mediaType = MediaType.parse("application/json; charset=utf-8");
var body = RequestBody.create(jsonObject.toString(), mediaType);
var request = new Request.Builder()
.url("https://realtime.oxylabs.io/v1/queries")
.post(body)
.build();
try (var response = client.newCall(request).execute()) {
if (response.body() != null) {
try (var responseBody = response.body()) {
System.out.println(responseBody.string());
}
}
} catch (Exception exception) {
System.out.println("Error: " + exception.getMessage());
}
System.exit(0);
}
public static void main(String[] args) {
new Thread(new Main()).start();
}
}
Additional parameters: Optionally, you can include additional parameters such as geo_location, user_agent_type, and more to customize your scraping request.
Additional parameters: Optionally, you can include additional parameters such as geo_location, user_agent_type, and more to customize your scraping request.
Upon submitting a request, you will promptly receive a JSON response containing all job details, including job parameters, job ID, and URLs for downloading job results:
GET https://data.oxylabs.io/v1/queries/{job_id}/results
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=raw
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=parsed
GET https://data.oxylabs.io/v1/queries/{job_id}/results?type=pn
If you need any assistance in making your first request, feel free to contact us via the 24/7 available live chat.
All information herein is provided on an “as is” basis and for informational purposes only. We make no representation and disclaim all liability with respect to your use of any information contained on this page. Before engaging in scraping activities of any kind you should consult your legal advisors and carefully read the particular website’s terms of service or receive a scraping license.