Products
Get Products
GET
/products
Returns a product list containing plans, locations, questions and quantity discounts.
Example request:
curl -X GET "https://apid.iproyal.com/v1/reseller/products" \
-H "X-Access-Token: <your_access_token>" \
-H "Content-Type: application/json"
const https = require('https');
const api_token = '<your_access_token>';
const options = {
hostname: 'apid.iproyal.com',
path: '/v1/reseller/products',
method: 'GET',
headers: {
'X-Access-Token': api_token,
'Content-Type': 'application/json'
}
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log(responseData);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.end();
import requests
api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/products'
headers = {
'X-Access-Token': api_token,
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
const https = require('https');
const api_token = '<your_access_token>';
const options = {
hostname: 'apid.iproyal.com',
path: '/v1/reseller/products',
method: 'GET',
headers: {
'X-Access-Token': api_token,
'Content-Type': 'application/json'
}
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log(responseData);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.end();
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiRequest {
public static void main(String[] args) {
String apiToken = "<your_access_token>";
String urlString = "https://apid.iproyal.com/v1/reseller/products";
try {
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("X-Access-Token", apiToken);
connection.setRequestProperty("Content-Type", "application/json");
int responseCode = connection.getResponseCode();
System.out.println("Response Code: " + responseCode);
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println("Response Body: " + content.toString());
} else {
System.out.println("GET request failed. Response Code: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
)
const (
apiToken = "<your_access_token>"
url = "https://apid.iproyal.com/v1/reseller/products"
)
func main() {
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
log.Fatal("Error creating request:", err)
}
req.Header.Set("X-Access-Token", apiToken)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatal("Error making request:", err)
}
defer resp.Body.Close()
fmt.Println("Status Code:", resp.StatusCode)
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal("Error reading response body:", err)
}
var jsonResponse map[string]interface{}
err = json.Unmarshal(responseBody, &jsonResponse)
if err != nil {
log.Fatal("Error unmarshaling JSON:", err)
}
fmt.Printf("%+v\n", jsonResponse)
}
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string apiToken = "<your_access_token>";
string url = "https://apid.iproyal.com/v1/reseller/products";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("X-Access-Token", apiToken);
HttpResponseMessage response = await client.GetAsync(url);
Console.WriteLine((int)response.StatusCode);
string responseText = await response.Content.ReadAsStringAsync();
var jsonResponse = JsonSerializer.Deserialize<JsonElement>(responseText);
Console.WriteLine(jsonResponse);
}
}
}
Example response:
{
"data": [
{
"id": 9,
"name": "Static Residential",
"plans": [
{
"id": 4,
"name": "30 Days",
"price": 2,
"min_quantity": 5,
"max_quantity": 100000
},
...
],
"locations": [
{
"id": 51,
"name": "Australia",
"out_of_stock": false,
"available_proxies_count": 1142
},
...
],
"questions": [
{
"id": 5,
"text": "On which website do you plan to use them?",
"is_required": false
}
],
"quantity_discounts": [
{
"quantity_from": 99,
"discount_percent": 5
},
...
]
},
...
]
}
Last updated