### Example GET Request to Query Documentation Source: https://developers.oxylabs.io/products/headless-browser/features/handling-captcha-events.md Use this GET request to ask a question about the documentation. The `ask` parameter specifies the question, and the optional `goal` parameter provides context for the desired outcome. ```bash GET https://developers.oxylabs.io/products/headless-browser/features/handling-captcha-events.md?ask=&goal= ``` -------------------------------- ### Query Documentation Example Source: https://developers.oxylabs.io/api-targets/search-engines/google/trends-explore.md To get additional information not directly on the page, make an HTTP GET request to the page URL with the 'ask' parameter for your question and an optional 'goal' parameter. ```http GET https://developers.oxylabs.io/api-targets/search-engines/google/trends-explore.md?ask=&goal= ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://developers.oxylabs.io/help-center/products-and-features/how-to-use-session-control.md This example demonstrates how to query the documentation dynamically using HTTP GET requests with 'ask' and optional 'goal' parameters. This is useful for retrieving information not explicitly present on the current page. ```http GET https://developers.oxylabs.io/help-center/products-and-features/how-to-use-session-control.md?ask=&goal= ``` -------------------------------- ### Node.js Request for Aliexpress HTML Source: https://developers.oxylabs.io/api-targets/e-commerce/aliexpress/url.md This Node.js example shows how to make an HTTPS POST request to get Aliexpress HTML content. It includes basic authentication setup. ```javascript const https = require("https"); const username = "USERNAME"; const password = "PASSWORD"; const body = { source: "aliexpress", url: "https://www.aliexpress.com/w/wholesale-Tablets.html", render: "html" }; const options = { hostname: "realtime.oxylabs.io", path: "/v1/queries", method: "POST", headers: { "Content-Type": "application/json", Authorization: "Basic " + Buffer.from(`${username}:${password}`).toString("base64"), }, }; const request = https.request(options, (response) => { let data = ""; response.on("data", (chunk) => { data += chunk; }); response.on("end", () => { const responseData = JSON.parse(data); console.log(JSON.stringify(responseData, null, 2)); }); }); request.on("error", (error) => { console.error("Error:", error); }); request.write(JSON.stringify(body)); request.end(); ``` -------------------------------- ### HTTP GET Request for Amazon Best Sellers Source: https://developers.oxylabs.io/api-targets/e-commerce/amazon/best-sellers.md This is an example of an HTTP GET request URL for fetching Amazon Best Sellers data. It includes query parameters for source, domain, query, render, and start page. An `access_token` is also shown as an alternative to basic authentication. ```http https://realtime.oxylabs.io/v1/queries?source=amazon_bestsellers&domain=com&query=172541&render=html&start_page=2&parse=true&access_token=12345abcde ``` -------------------------------- ### Node.js Example for Country Selection Source: https://developers.oxylabs.io/products/proxies/datacenter-proxies/select-country.md This Node.js example utilizes the 'axios' library to target a specific country. Install the library using 'npm install axios'. ```javascript //npm install axios const axios = require("axios"); const https = require("https"); const client = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false, }), }); const username = 'USERNAME'; const country = 'COUNTRY' const password = 'PASSWORD' client .get("https://ip.oxylabs.io/location", { proxy: { protocol: "https", host: "dc.oxylabs.io", port: 8000, auth: { username: `user-${username}-country-${country}`, password: password, }, }, }) .then((res) => { console.log(res.data); }) .catch((err) => console.error(err)); ``` -------------------------------- ### Query Documentation Dynamically Source: https://developers.oxylabs.io/products/proxies/datacenter-proxies/protocols.md This example shows how to perform an HTTP GET request to query the documentation dynamically using the 'ask' and 'goal' query parameters. ```http GET https://developers.oxylabs.io/products/proxies/datacenter-proxies/protocols.md?ask=&goal= ``` -------------------------------- ### Grainger API HTTP GET Request Example Source: https://developers.oxylabs.io/api-targets/e-commerce/grainger.md This example shows how to construct an HTTP GET request URL for the Grainger API. Note that the entire query string must be URL-encoded. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=grainger_search&query=pipe&access_token=12345abcde ``` -------------------------------- ### Java Example for MediaMarkt Product API Source: https://developers.oxylabs.io/api-targets/e-commerce/mediamarkt/product.md This Java code demonstrates how to fetch MediaMarkt product data using the Oxylabs Realtime API with OkHttp. Replace USERNAME and PASSWORD with your credentials. ```java package org.example; import okhttp3.*; import org.json.JSONArray; 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", "mediamarkt_product"); jsonObject.put("product_id", "2966544"); 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(); } } ``` -------------------------------- ### HTTP GET request example Source: https://developers.oxylabs.io/api-targets/llms-and-ai/perplexity.md This example shows how to make a GET request to the Perplexity API endpoint. Note the use of URL-encoded parameters. An `access_token` is included, which may be an alternative to basic authentication in some contexts. ```http https://realtime.oxylabs.io/v1/queries?source=perplexity&prompt=top%203%20smartphones%20in%202025%2C%20compare%20pricing%20across%20US%20marketplaces&geo_location=United%20States&parse=true&access_token=12345abcde ``` -------------------------------- ### Credentials List Example with Session Time Source: https://developers.oxylabs.io/products/proxies/mobile-proxies/session-control.md Demonstrates a list of credentials establishing different sessions with varying session times in minutes. ```text customer-USERNAME-sessid-iqwcp-sesstime-5:PASSWORD customer-USERNAME-sessid-tevab-sesstime-12:PASSWORD customer-USERNAME-sessid-6drwn-sesstime-30:PASSWORD customer-USERNAME-sessid-7eh7g-sesstime-60:PASSWORD customer-USERNAME-sessid-z7cao-sesstime-1440:PASSWORD ``` -------------------------------- ### Show All Available Proxy Lists (C#) Source: https://developers.oxylabs.io/products/proxies/dedicated-datacenter-proxies/enterprise/proxy-lists.md This C# example shows how to make a GET request to retrieve all proxy lists, including setting up Basic Authentication. ```csharp using System; using System.Net; using System.Text; class Example { static void Main() { HttpClient client = new HttpClient(); var byteArray = Encoding.ASCII.GetBytes("username:password"); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); var task = Task.Run(async () => { var response = await client.GetAsync("https://api.oxylabs.io/v1/proxies/lists"); var content = response.Content; var result = await content.ReadAsStringAsync(); return result; }); task.Wait(); Console.WriteLine(task.Result); } } ``` -------------------------------- ### HTTP GET Request for Kroger Product Source: https://developers.oxylabs.io/api-targets/e-commerce/kroger/product.md This is an example of an HTTP GET request to the Kroger Product API. Note that this example includes an 'access_token' which might be used in some scenarios, but the primary authentication is typically via username/password. ```http https://realtime.oxylabs.io/v1/queries?source=kroger_product&product_id=0021006550000&delivery_zip=65401&fulfillment_type=pickup&store_id=01100002&access_token=12345abcde ``` -------------------------------- ### Static Session Example Source: https://developers.oxylabs.io/integrations/proxy-integrations/mobile-proxies-guides/oxy-proxy-extension-for-chrome-1.md Example of configuring a static session using the 'sessid-' parameter appended to the username. ```text customer-USERNAME-sessid-123 ``` -------------------------------- ### HTTP GET Request for Tokopedia Search Source: https://developers.oxylabs.io/api-targets/e-commerce/tokopedia/search.md This example shows how to perform a Tokopedia search using an HTTP GET request with query parameters. Note that the entire query string must be URL-encoded. An `access_token` is shown as an example parameter. ```http https://realtime.oxylabs.io/v1/queries?source=tokopedia_search&query=shampoo&access_token=12345abcde ``` -------------------------------- ### HTTP GET Request for Google Trends Explore Source: https://developers.oxylabs.io/api-targets/search-engines/google/trends-explore.md This is an example of an HTTP GET request to retrieve Google Trends data. Note that this example includes an `access_token` which might be specific to certain API integrations and may not be universally applicable for standard authentication. ```http https://realtime.oxylabs.io/v1/queries?source=google_trends_explore&query=adidas&context[0][key]=date_from&context[0][value]=2021-01-01&&context[1][key]=date_to&context[1][value]=2022-02-02&context[2][key]=category_id&context[0][value]=3&access_token=12345abcde ``` -------------------------------- ### Querying Documentation Dynamically Source: https://developers.oxylabs.io/products/proxies/mobile-proxies/getting-started.md This example shows how to perform an HTTP GET request to query the documentation dynamically using the 'ask' and optional 'goal' query parameters. ```http GET https://developers.oxylabs.io/products/proxies/mobile-proxies/getting-started.md?ask=&goal= ``` -------------------------------- ### Java Example for Alibaba Realtime Integration Source: https://developers.oxylabs.io/api-targets/e-commerce/alibaba/url.md Shows how to make a POST request to the Alibaba API using Java with OkHttp. This example includes setting up authentication and handling the response. ```java package org.example; import okhttp3.*; import org.json.JSONArray; 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", "alibaba"); jsonObject.put("url", "https://www.alibaba.com/trade/search?SearchText=case"); jsonObject.put("render", "html"); 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(); } } ``` -------------------------------- ### HTTP GET Request for Bed Bath & Beyond Product Source: https://developers.oxylabs.io/api-targets/e-commerce/bedbathandbeyond/product.md This is an example of an HTTP GET request URL to retrieve a Bed Bath & Beyond product page. Note that the entire query string must be URL-encoded. This example uses a placeholder `access_token`. ```http https://realtime.oxylabs.io/v1/queries?source=bedbathandbeyond_product&product_id=38932412&access_token=12345abcde ``` -------------------------------- ### HTTP GET Request for Grainger URL Source: https://developers.oxylabs.io/api-targets/e-commerce/grainger/url.md An example of how to construct an HTTP GET request with query parameters to scrape a Grainger URL. ```http https://realtime.oxylabs.io/v1/queries?source=grainger&url=https%3A%2F%2Fwww.grainger.com%2Fproduct%2FLITHONIA-LIGHTING-Exit-Sign-LED-1THX7&access_token=12345abcde ``` -------------------------------- ### Querying Documentation with GitBook Source: https://developers.oxylabs.io/products/web-unblocker/sample-responses.md This example shows how to query the documentation dynamically using an HTTP GET request. The `ask` parameter specifies the question, and the optional `goal` parameter provides context for the answer. ```http GET https://developers.oxylabs.io/products/web-unblocker/sample-responses.md?ask=&goal= ``` -------------------------------- ### Get BestBuy Product HTML using HTTP GET Source: https://developers.oxylabs.io/api-targets/e-commerce/bestbuy/product.md This HTTP GET request example shows how to retrieve parsed BestBuy product data. Note that the entire query string must be URL-encoded. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=bestbuy_product&product_id=6586591&parse=true&access_token=12345abcde ``` -------------------------------- ### Java Session Control Example Source: https://developers.oxylabs.io/products/proxies/residential-proxies/session-control.md Demonstrates how to set up and use a client for residential proxies in Java, including session ID management and making HTTP requests. ```java package example; import java.io.*; import java.util.Random; import org.apache.http.HttpHost; import org.apache.http.auth.*; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.fluent.Request; import org.apache.http.client.methods.*; import org.apache.http.impl.client.*; import org.apache.http.impl.conn.BasicHttpClientConnectionManager; import org.apache.http.util.EntityUtils; class Client { public static final String username = "USERNAME"; public static final String password = "PASSWORD"; public String session_id = Integer.toString(new Random().nextInt(Integer.MAX_VALUE)); public CloseableHttpClient client; public Client(String country) { String login = "customer-"+username+(country!=null ? "-cc-"+country : "") +"-sessid-" + session_id; HttpHost entry_node = new HttpHost("pr.oxylabs.io:7777"); CredentialsProvider credentials_provider = new BasicCredentialsProvider(); credentials_provider.setCredentials(new AuthScope(entry_node), new UsernamePasswordCredentials(login, password)); client = HttpClients.custom() .setConnectionManager(new BasicHttpClientConnectionManager()) .setProxy(entry_node) .setDefaultCredentialsProvider(credentials_provider) .build(); } public String request(String url) throws IOException { HttpGet request = new HttpGet(url); CloseableHttpResponse response = client.execute(request); try { return EntityUtils.toString(response.getEntity()); } finally { response.close(); } } public void close() throws IOException { client.close(); } } public class Example { public static void main(String[] args) throws IOException { Client client = new Client("de"); try { System.out.println(client.request("https://ip.oxylabs.io/location")); } finally { client.close(); } } } ``` -------------------------------- ### Go Example for Proxy Rotation Source: https://developers.oxylabs.io/products/proxies/dedicated-datacenter-proxies/self-service/proxy-rotation.md Provides a Go example for setting up proxy rotation with country targeting. ```go package main import ( "fmt" "io" "net/http" "net/url" ) func main() { username, country, password, entry := "USERNAME", "COUNTRY", "PASSWORD", "ddc.oxylabs.io:8000" proxy, err := url.Parse(fmt.Sprintf("https://user-%s-country-%s:%s@%s", username, country, password, entry)) if err != nil { panic(err) } transport := &http.Transport{ Proxy: http.ProxyURL(proxy), } client := &http.Client{Transport: transport} target := "https://ip.oxylabs.io/location" response, err := client.Get(target) if err != nil { panic(err) } defer response.Body.Close() body, err := io.ReadAll(response.Body) if err != nil { panic(err) } fmt.Println("Response:") fmt.Println(string(body)) } ``` -------------------------------- ### Making a Request with Node.js Source: https://developers.oxylabs.io/products/proxies/isp-proxies/making-requests.md This Node.js example uses the 'axios' library to make a request through an ISP proxy. Install axios with 'npm install axios'. ```javascript //npm install axios const axios = require("axios"); const https = require("https"); const client = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false, }), }); const username = 'USERNAME'; const password = 'PASSWORD' client .get("https://ip.oxylabs.io/location", { proxy: { protocol: "https", host: "isp.oxylabs.io", port: 8001, auth: { username: `user-${username}`, password: password, }, }, }) .then((res) => { console.log(res.data); }) .catch((err) => console.error(err)); ``` -------------------------------- ### HTTP GET Request for Tokopedia URL Source: https://developers.oxylabs.io/api-targets/e-commerce/tokopedia/url.md This example shows how to construct an HTTP GET request with URL-encoded parameters to fetch Tokopedia page content. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=tokopedia&url=https%3A%2F%2Fwww.tokopedia.com%2Fadidasindonesiaofficial%2Fadidas-running-response-runner-shoes-unisex-grey-ih6102-1731439470322550359&access_token=12345abcde ``` -------------------------------- ### Example HTTP GET Request to Query Documentation Source: https://developers.oxylabs.io/integrations/proxy-integrations/dedicated-datacenter-proxies-guides/enterprise/dicloak-1.md Use this GET request to ask specific questions about the documentation. The `ask` parameter is mandatory for your question, and the `goal` parameter is optional for specifying your overall objective. ```http GET https://developers.oxylabs.io/integrations/proxy-integrations/dedicated-datacenter-proxies-guides/enterprise/dicloak-1.md?ask=&goal= ``` -------------------------------- ### C# Example for Google Shopping Product API Source: https://developers.oxylabs.io/api-targets/search-engines/google/shopping/shopping-product.md Demonstrates how to send a POST request to the Google Shopping Product API using C#. Includes authentication and JSON payload creation. ```csharp 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 = "google_shopping_product", query = "[product_token_string]", render = "html", parse = true }; 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); } } } ``` -------------------------------- ### Mercado Libre Scraper URL Example Source: https://developers.oxylabs.io/api-targets/e-commerce/mercado-libre/url.md Example of a GET request to the Mercado Libre API endpoint. Use this to scrape data from Mercado Libre. ```http GET https://developers.oxylabs.io/api-targets/e-commerce/mercado-libre/url.md?ask=&goal= ``` -------------------------------- ### Make a request with Node.js Source: https://developers.oxylabs.io/products/proxies/datacenter-proxies.md This Node.js example uses 'axios' to send a request via a Datacenter Proxy. Install the library using `npm install axios`. ```javascript //npm install axios const axios = require("axios"); const https = require("https"); const client = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false, }), }); const username = 'USERNAME'; const password = 'PASSWORD' client .get("https://ip.oxylabs.io/location", { proxy: { protocol: "https", host: "dc.oxylabs.io", port: 8000, auth: { username: `user-${username}`, password: password, }, }, }) .then((res) => { console.log(res.data); }) .catch((err) => console.error(err)); ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://developers.oxylabs.io/integrations/proxy-integrations/isp-proxies-guides/adspower.md Use this GET request to ask questions about the documentation dynamically. The 'ask' parameter contains the question, and 'goal' specifies the broader objective. ```http GET https://developers.oxylabs.io/integrations/proxy-integrations/isp-proxies-guides/adspower.md?ask=&goal= ``` -------------------------------- ### HTTP GET Request to Zillow API Source: https://developers.oxylabs.io/api-targets/real-estate/zillow/url.md This example shows how to construct an HTTP GET request URL for the Zillow API. Note that parameters need to be URL-encoded. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=zillow&url=https%3A%2F%2Fwww.zillow.com%2Fhomes%2Ffor_sale%2F792613_rid%2F&access_token=12345abcde ``` -------------------------------- ### Credentials List Example Source: https://developers.oxylabs.io/products/proxies/mobile-proxies/session-control.md Demonstrates the format for a list of credentials, each establishing a unique session. ```text customer-USERNAME-sessid-iqwcp:PASSWORD customer-USERNAME-sessid-tevab:PASSWORD customer-USERNAME-sessid-6drwn:PASSWORD customer-USERNAME-sessid-7eh7g:PASSWORD customer-USERNAME-sessid-z7cao:PASSWORD ``` -------------------------------- ### HTTP GET Request for Publix URL Source: https://developers.oxylabs.io/api-targets/e-commerce/publix/url.md This example shows how to construct a URL for fetching Publix data via a GET request. Ensure all parameters are URL-encoded. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=publix&url=https%3A%2F%2Fwww.publix.com%2Fsavings%2Fall-deals&store_id=24&access_token=12345abcde ``` -------------------------------- ### Java Example for Walmart Product API Source: https://developers.oxylabs.io/api-targets/e-commerce/walmart/product.md Shows how to make a POST request to the Oxylabs Realtime API for Walmart product data using Java and OkHttp. Includes setting up authenticator and request body. ```java 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", "walmart_product"); jsonObject.put("product_id", "15296401808"); jsonObject.put("parse", true); 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(); } } ``` -------------------------------- ### HTTP GET Request for IndiaMART URL Source: https://developers.oxylabs.io/api-targets/e-commerce/indiamart/url.md This example shows how to construct an HTTP GET request URL for fetching IndiaMART data, including URL encoding. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=indiamart&url=https%3A%2F%2Fdir.indiamart.com%2Fimpcat%2Fsolar-panels.html&access_token=12345abcde ``` -------------------------------- ### C# Example for Best Buy Product API Source: https://developers.oxylabs.io/api-targets/e-commerce/bestbuy/product.md Demonstrates how to send a POST request to the Oxylabs Realtime API to retrieve Best Buy product data using C#. Includes setting up HttpClient, authentication, and request parameters. ```csharp 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 = "bestbuy_product", product_id = "6586591", parse = true }; 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); } } } ``` -------------------------------- ### Querying Documentation with GET Request Source: https://developers.oxylabs.io/products/web-scraper-api/solutions-for-ai-workflows/langchain.md Demonstrates how to perform an HTTP GET request to query the documentation dynamically. Use the `ask` parameter for specific questions and the optional `goal` parameter to tailor the response. ```bash GET https://developers.oxylabs.io/products/web-scraper-api/solutions-for-ai-workflows/langchain.md?ask=&goal= ``` -------------------------------- ### HTTP GET Request for Falabella Product Source: https://developers.oxylabs.io/api-targets/e-commerce/falabella/product.md This is an example of an HTTP GET request for Falabella product data. Note that the entire query string must be URL-encoded. ```http https://realtime.oxylabs.io/v1/queries?source=falabella_product&product_id=prod129939632&access_token=12345abcde ``` -------------------------------- ### C# Example for Alibaba Realtime Integration Source: https://developers.oxylabs.io/api-targets/e-commerce/alibaba/url.md Demonstrates how to send a POST request to the Alibaba API using C# and HttpClient. Includes setting up authentication and request parameters. ```csharp 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 = "alibaba", url = "https://www.alibaba.com/trade/search?SearchText=case", render = "html" }; 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); } } } ``` -------------------------------- ### HTTP GET Request for Alibaba Product Source: https://developers.oxylabs.io/api-targets/e-commerce/alibaba/product.md This example shows how to construct an HTTP GET request URL to retrieve Alibaba product HTML. The entire query string must be URL-encoded. Note: This example uses an 'access_token' which might be specific to certain integrations and not the standard USERNAME:PASSWORD authentication. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=alibaba_product&product_id=1601557767120&render=html&access_token=12345abcde ``` -------------------------------- ### Node.js Example for Static Session Source: https://developers.oxylabs.io/products/proxies/datacenter-proxies/ip-control.md This Node.js example uses the 'axios' library to connect to Datacenter Proxies, maintaining a static IP for the session. Ensure 'axios' is installed. ```javascript //npm install axios const axios = require("axios"); const https = require("https"); const client = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false, }), }); const username = 'USERNAME'; const password = 'PASSWORD' client .get("https://ip.oxylabs.io/location", { proxy: { protocol: "https", host: "dc.oxylabs.io", port: 35467, auth: { username: `user-${username}`, password: password, }, }, }) .then((res) => { console.log(res.data); }) .catch((err) => console.error(err)); ``` -------------------------------- ### Go Example for Proxy Rotation Source: https://developers.oxylabs.io/products/proxies/dedicated-datacenter-proxies/self-service/proxy-rotation.md This Go program demonstrates proxy rotation using the standard net/http package. It parses the proxy URL and configures the HTTP client. ```go package main import ( "fmt" "io" "net/http" "net/url" ) func main() { username, password, entry := "USERNAME", "PASSWORD", "ddc.oxylabs.io:8000" proxy, err := url.Parse(fmt.Sprintf("https://user-%s:%s@%s", username, password, entry)) if err != nil { panic(err) } transport := &http.Transport{ Proxy: http.ProxyURL(proxy), } client := &http.Client{Transport: transport} target := "https://ip.oxylabs.io/location" response, err := client.Get(target) if err != nil { panic(err) } defer response.Body.Close() body, err := io.ReadAll(response.Body) if err != nil { panic(err) } fmt.Println("Response:") fmt.Println(string(body)) } ``` -------------------------------- ### Java Example for Alibaba Search API Source: https://developers.oxylabs.io/api-targets/e-commerce/alibaba/search.md Shows how to make a POST request to the Alibaba Search API using Java and OkHttp. Covers setting up the client, authentication, and request body. ```java 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", "alibaba_search"); jsonObject.put("query", "case"); jsonObject.put("render", "html"); 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(); } } ``` -------------------------------- ### Python Example for Country Selection Source: https://developers.oxylabs.io/products/proxies/datacenter-proxies/select-country.md This Python script uses the 'requests' library to send a request to a specific country. Ensure you have the library installed (`pip install requests`). ```python #pip install requests import requests username = 'USERNAME' password = 'PASSWORD' country = 'COUNTRY' proxy = 'dc.oxylabs.io:8000' proxies = { "https": ('https://user-%s-country-%s:%s@%s' % (username, country, password, proxy)) } response=requests.get("https://ip.oxylabs.io/location", proxies=proxies) print(response.content) ``` -------------------------------- ### Datacenter Proxy Static Session with Go Source: https://developers.oxylabs.io/products/proxies/datacenter-proxies/ip-control.md This Go example demonstrates how to set up and use a static session with Datacenter Proxies by configuring the HTTP transport with proxy details. ```go package main import ( "fmt" "io" "net/http" "net/url" ) func main() { username, password, entry := "USERNAME", "PASSWORD", "dc.oxylabs.io:8001" proxy, err := url.Parse(fmt.Sprintf("https://user-%s:%s@%s", username, password, entry)) if err != nil { panic(err) } transport := &http.Transport{ Proxy: http.ProxyURL(proxy), } client := &http.Client{Transport: transport} target := "https://ip.oxylabs.io/location" response, err := client.Get(target) if err != nil { panic(err) } defer response.Body.Close() body, err := io.ReadAll(response.Body) if err != nil { panic(err) } fmt.Println("Response:") fmt.Println(string(body)) } ``` -------------------------------- ### HTTP GET Request for Google Search Source: https://developers.oxylabs.io/api-targets/search-engines/google/ai-overviews.md This is an example of an HTTP GET request URL for the Google Search API. It includes query parameters and an access token for authentication. ```http https://realtime.oxylabs.io/v1/queries?source=google_search&query=Emporio%20Armani%20EA3192&render=html&user_agent_type=desktop&access_token=12345abcde ``` -------------------------------- ### HTTP GET Request for Rakuten Search Source: https://developers.oxylabs.io/api-targets/e-commerce/rakuten.md This example shows how to construct an HTTP GET request for Rakuten searches. Note that the entire query string must be URL-encoded. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=rakuten_search&query=iphone&access_token=12345abcde ``` -------------------------------- ### Java Example for Best Buy Product API Source: https://developers.oxylabs.io/api-targets/e-commerce/bestbuy/product.md Shows how to make a POST request to the Oxylabs Realtime API for Best Buy product data using Java and OkHttp. Covers setting up the client, authentication, and request body. ```java 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", "bestbuy_product"); jsonObject.put("product_id", "6586591"); jsonObject.put("parse", true); 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(); } } ``` -------------------------------- ### C# Example for Aliexpress Search Source: https://developers.oxylabs.io/api-targets/e-commerce/aliexpress/search.md Demonstrates how to perform an Aliexpress search using the Oxylabs Realtime API in C#. Includes setting up HttpClient, authentication, and sending a POST request. ```csharp 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 = "aliexpress_search", query = "case", render = "html" }; 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); } } } ``` -------------------------------- ### HTTP GET Request for Rakuten URL Source: https://developers.oxylabs.io/api-targets/e-commerce/rakuten/url.md This example shows how to construct a URL for a GET request to the Rakuten API, including URL encoding for parameters and an access token. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=rakuten&url=https%3A%2F%2Fwww.rakuten.com.tw%2Fshop%2Flong3269806640%2Fproduct%2Fprczm32bm%2F%3Fl-id%3Dtw_search_product_thumbnail_6&access_token=12345abcde ``` -------------------------------- ### HTTP GET Request for Petco URL Source: https://developers.oxylabs.io/api-targets/e-commerce/petco/url.md This HTTP example shows how to construct a URL-encoded GET request to the Oxylabs Realtime API, including an access token for authentication. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=petco&url=https://www.petco.com/shop/en/petcostore/product/pro-plan-savor-shredded-blend-beef-and-rice-adult-dog-food&access_token=12345abcde ``` -------------------------------- ### Java Example for Google Shopping Product API Source: https://developers.oxylabs.io/api-targets/search-engines/google/shopping/shopping-product.md Shows how to make a POST request to the Google Shopping Product API using Java with OkHttp. Handles authentication and constructs the JSON request body. ```java 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", "google_shopping_product"); jsonObject.put("query", "[product_token_string]"); jsonObject.put("render", "html"); jsonObject.put("parse", true); 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(); } } ``` -------------------------------- ### HTTP GET Request for Petco Search Source: https://developers.oxylabs.io/api-targets/e-commerce/petco/search.md This example shows how to construct an HTTP GET request URL for Petco search, including query parameters and an access token. ```http # The whole string you submit has to be URL-encoded. https://realtime.oxylabs.io/v1/queries?source=petco_search&query=food&access_token=12345abcde ```