获取可用的机房代理和静态住宅代理的IP数量

API endpoint: GET /api/zone/count_available_ips
Parameters:
  • zone=ZONE [string] - name of the Zone
  • plan={...} [JSON object] - abstract plan parameters
    • pool_ip_type=static_res [string] - should search in ISP instead of DC
    • ips_type=shared|selective|dedicated [string] - type of the IPs
      * Note : when ips_type=selective, domain_whitelist is required
    • country=country_name [string] - IPs location country
    • country_city=country_name-city_name [string] - defines the city location of the IPs
    • city=true [boolean] - requred with "country_city" parameter
    • domain_whitelist=d1.com d2.com [string] - space separated list of domains.
      * Note: for [curl] the spaces should be urlencoded : d1.com%20d2.com
    • geo_db={...} [JSON object] - turns on/off using of the IP`s location databases
      • maxmind=true [boolean] - use MaxMind IP location DB
      • dbip=true [boolean] - use DB-IP IP location DB
      • google=true [boolean] - use Google IP location DB
      • ip2location=true [boolean] - use IP2Location IP location DB
      • ipcn=true [boolean] - use ip.cn IP location DB
Sample Response: {count: 1234}
 
Plan Examples :
  • Available IPs for current Zone plan:

    curl "https://brightdata.com/api/count_available_ips?zone=ZONE" -H "Authorization: Bearer API_TOKEN"
  • Abstract plan, dedicated IPs:

    curl "https://brightdata.com/api/count_available_ips?plan=\{\"ips_type\":\"dedicated\"\}" -H "Authorization: Bearer API_TOKEN"
  • Abstract plan, shared IPs located in United States:

    curl "https://brightdata.com/api/count_available_ips?plan=\{\"country\":\"us\",\"ips_type\":\"shared\"\}" -H "Authorization: Bearer API_TOKEN"
  • Abstract plan, dedicated ips located in United States:

    curl "https://brightdata.com/api/count_available_ips?plan=\{\"country\":\"us\",\"ips_type\":\"dedicated\"\}" -H "Authorization: Bearer API_TOKEN"
  • Abstract plan, shared IPs located in United States, Denver:

    curl "https://brightdata.com/api/count_available_ips?plan=\{\"ips_type\":\"shared\",\"country_city\":\"us-denver\",\"city\":true\}" -H "Authorization: Bearer API_TOKEN"
  • Abstract plan, shared IPs located in US, exclusive for domains: amazon.com, fb.com:

    curl "https://brightdata.com/api/count_available_ips?plan=\{\"ips_type\":\"selective\",\"country\":\"us\",\"domain_whitelist\":\"amazon.com%20fb.com\"\}" -H "Authorization: Bearer API_TOKEN"
  • Abstract plan, shared IPs located in US, geo IP databases: should persist in both maxmind and dbip:

    curl "https://brightdata.com/api/count_available_ips?plan=\{\"ips_type\":\"shared\",\"country\":\"us\",\"geo_db\":\{\"maxmind\":true,\"dbip\":true\}\}" -H "Authorization: Bearer API_TOKEN"

 

Shell
curl "https://brightdata.com/api/zone/count_available_ips?[zone=ZONE&plan={...}]" -H "Authorization: Bearer API_TOKEN"

Node.js

#!/usr/bin/env node
require('request-promise')({
	url: 'https://brightdata.com/api/zone/count_available_ips?[zone=ZONE&plan={...}]',
	headers: {'Authorization': 'Bearer API_TOKEN'},
}).then(function(data){ console.log(data); },
	function(err){ console.error(err); });

Java

package example;

import org.apache.http.HttpHost;
import org.apache.http.client.fluent.*;

public class Example {
  public static void main(String[] args) throws Exception {
    String res = Executor.newInstance()
      .addHeader("Authorization", "Bearer API_TOKEN")
.execute(Request.Get("https://brightdata.com/api/zone/count_available_ips?[zone=ZONE&plan={...}]"))
.returnContent().asString(); System.out.println(res) }
}

C#

using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;

public class Program {
  public static async Task Main() {
    var client = new HttpClient();
    var requestMessage = new HttpRequestMessage {
      Method = HttpMethod.Get,
RequestUri = new Uri("https://brightdata.com/api/zone/count_available_ips?[zone=ZONE&plan={...}]"), Headers = { {"Authorization", "Bearer API_TOKEN"} } }; var response = await client.SendAsync(requestMessage); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); } }

Python

#!/usr/bin/env python
print('If you get error "ImportError: No module named requests", please install it:\n$ sudo pip install requests');
import requests

headers = {'Authorization': 'Bearer API_TOKEN'}
r = requests.get('https://brightdata.com/api/zone/count_available_ips?[zone=ZONE&plan={...}]', headers=headers)
print(r.content)

这篇文章有帮助吗?