添加代理通道

Ori Goren-Bar 阳锐
Ori Goren-Bar 阳锐
  • 更新于
API endpoint: POST /api/zone
POST body :
  • zone [JSON] [Required]
    • name=NAME [string] - Zone name
  • plan [JSON] [Required]
    • type="static|resident|unblocker" [string]
      • 'static' : Datacenter, ISP
      • 'resident' : Residential, Mobile, SERP
      • 'unblocker' : unlocker
    • ips_type="shared|dedicated|selective" [string] - specify this parameter when adding a Datacenter or ISP zone
      • 'shared' : Shared
      • 'dedicated' : Exclusive - All domain
      • 'selective' : Exclusvie - Exclusive domain specified (domain_whitelist is required)
    • bandwidth="payperusage|unlimited" [string]
      • 'unlimited' : enable unlimited bandwidth, this setting will be applied only to Datacenter - Shared per IP or Exclusive types.
    • ip_alloc_preset="shared_block|shared_res_block" [string] - to set a zone with Shared - Pay per usage type.
    • ips=0 [integer] - number of static IPs to allocate to the zone
    • country="any" [string] - specify which country IP to allocate to the zone, specify this parameter when 'ips_type=static'
    • country_city="any" [string] - country code followed by city (e.g. "se-stockholm") - specify which City IP to allocate to the zone, specify this parameter when 'ips_type=static'
    • mobile=false [boolean] - 'true' when adding a Mobile proxy zone, type value must be 'resident'
    • serp=false [boolean] - 'true' when adding a Search Engine Crawler zone
    • city=false [boolean] - 'true' when enabling City targeting permission
    • asn=false [boolean] - 'true' when enabling ASN targeting permission
    • vip=false [boolean] - 'true' when allocating gIP (group of IPs)
    • vips_type="shared|domain" [string] - specify this parameter when adding a Residential or Mobile zone
      • 'shared' : Shared
      • 'domain' : Exclusive (domain_whitelist is required)
    • vips=0 [integer] - number of gIP (group of IPs) to allocate to the zone
    • domain_whitelist="d1.com d2.com" [string] - Space separated list of whitelisted domains
    • vip_country="any" [string] - specify which country IP to allocate to the zone, specify this parameter when 'ips_type=resident' and 'vip=true'
    • vip_country_city="any" [string] - country code followed by city (e.g. "se-stockholm") - specify which City IP to allocate to the zone, specify this parameter when 'ips_type=resident' and 'vip=true'
Sample Response:
{"plan":{"start":"2019-07-15T18:08:59.269Z","type":"static","ips_type":"shared","ip_alloc_preset":"shared_block","bandwidth":"payperusage"},"zone":{"ips":"any","password":["PASSWORD"],"plans":[{"start":"2019-07-15T18:08:59.269Z","type":"static","ips_type":"shared","ip_alloc_preset":"shared_block","bandwidth":"payperusage"}]}}
 
Plan Examples :
  • Add Datacenter - Shared - Pay per Usage zone :

    curl "https://brightdata.com/api/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static\",\"ips_type\":\"shared\",\"ip_alloc_preset\":\"shared_block\"}}"
  • Add ISP - Exclusive zone : 

    curl "https://brightdata.com/api/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static\",\"ips_type\":\"dedicated\",\"pool_ip_type\":\"static_res\",\"ips\":3}}"
  • Add Residential - Exclusive with Exclusive domain 'facebook.com' zone :

    curl "https://brightdata.com/api/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"resident\",\"vips_type\":\"domain\",\"vip\":true,\"vips\":3,\"domain_whitelist\":\"facebook.com\"}}"
  • Add Mobile - Shared zone : 

    curl "https://brightdata.com/api/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"resident\",\"mobile\":true,\"vips_type\":\"shared\"}}"
  • Add Unlocker zone :

    curl "https://brightdata.com/api/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"unblocker\"}}"
  • Add Search Engine Crawler zone : 

    curl "https://brightdata.com/api/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"resident\",\"serp\":true}}"
 
Shell
curl "https://brightdata.com/api/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static|resident\",\"ips_type\":\"shared|dedicated|selective\",\"ip_alloc_preset\":\"shared_block\",\"bandwidth\":\"payperusage|unlimited\",\"mobile\":false,\"city\":false,\"asn\":false,\"vip\":false,\"vips_type\":\"shared|vip|domain\",\"vips\":0,\"domain_whitelist\":\"test.com fb.com\",\"not_country\":null,\"vip_country\":\"any\",\"exclusive_sec\":0,\"exclusive_type\":\"days\",\"exclusive_num\":0,\"ips\":0}}"

Node.js

#!/usr/bin/env node
require('request-promise')({
	method: 'POST',
	url: 'https://brightdata.com/api/zone',
	json: {'zone':{'name': 'ZONE_NAME'},'plan':{'type':'static|resident','ips_type':'shared|dedicated|selective','ip_alloc_preset':'shared_block','bandwidth':'payperusage|unlimited','mobile':false,'city':false,'asn':false,'vip':false,'vips_type':'shared|vip|domain','vips':0,'domain_whitelist':'test.com fb.com','not_country':null,'vip_country':'any','exclusive_sec':0,'exclusive_type':'days','exclusive_num':0,'ips':0}},
	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 body = "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static|resident\",\"ips_type\":\"shared|dedicated|selective\",\"ip_alloc_preset\":\"shared_block\",\"bandwidth\":\"payperusage|unlimited\",\"mobile\":false,\"city\":false,\"asn\":false,\"vip\":false,\"vips_type\":\"shared|vip|domain\",\"vips\":0,\"domain_whitelist\":\"test.com fb.com\",\"not_country\":null,\"vip_country\":\"any\",\"exclusive_sec\":0,\"exclusive_type\":\"days\",\"exclusive_num\":0,\"ips\":0}}"; String res = Executor.newInstance() .addHeader("Authorization", "Bearer API_TOKEN")

.execute(Request.Post("https://brightdata.com/api/zone")
.bodyString(body, ContentType.APPLICATION_JSON))

.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.Post,
RequestUri = new Uri("https://brightdata.com/api/zone"), Headers = { {"Authorization", "Bearer API_TOKEN"} },
Content = new StringContent(JsonConvert.SerializeObject(new {
zone = new { name = "ZONE_NAME" },
plan = new { type = "static|resident", ips_type = "shared|dedicated|selective", ip_alloc_preset = "shared_block", bandwidth = "payperusage|unlimited", mobile = false, city = false, asn = false, vip = false, vips_type = "shared|vip|domain", vips = 0, domain_whitelist = "test.com fb.com", not_country = null, vip_country = "any", exclusive_sec = 0, exclusive_type = "days", exclusive_num = 0, ips = 0 }
}), Encoding.UTF8, "application/json")) }; 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

data = {'zone':{'name': 'ZONE_NAME'},'plan':{'type':'static|resident','ips_type':'shared|dedicated|selective','ip_alloc_preset':'shared_block','bandwidth':'payperusage|unlimited','mobile':false,'city':false,'asn':false,'vip':false,'vips_type':'shared|vip|domain','vips':0,'domain_whitelist':'test.com fb.com','not_country':null,'vip_country':'any','exclusive_sec':0,'exclusive_type':'days','exclusive_num':0,'ips':0}} headers = {'Authorization': 'Bearer API_TOKEN'} r = requests.post('https://brightdata.com/api/zone', data=json.dumps(data), headers=headers) print(r.content)
Share this

这篇文章有帮助吗?

1 人中有 1 人觉得有帮助