POST /dca/trigger_immediate?collector={ID_COLLECTOR}
POST Body
字符串
raw JSON
-d '[{"url":"https://targetwebsite.com/product_id/"}]'查询参数
字符串
抓取工具的唯一标识
字符串
设置为
dev 以触发抓取工具的开发版本字符串
human_name - 实时采集的数据名称,须易于识别和理解标头
字符串
授权持有者密钥
-H "Authorization: Bearer API_TOKEN"字符串
JSON/CSV/Multipart
-H "Content-Type: application/json"{
"response_id": "ID_RESPONSE",
}
curl "https://api.brightdata.com/dca/trigger_immediate?collector=ID_COLLECTOR" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"url\":\"https://targetwebsite.com/product_id/\"}"
#!/usr/bin/env node
require('request-promise')({
method: 'POST',
url: 'https://api.brightdata.com/dca/trigger_immediate?collector=ID_COLLECTOR',
json: {'url': 'https://targetwebsite.com/product_id/'},
headers: {'Authorization': 'Bearer API_TOKEN'},
}).then(function(data){ console.log(data); },
function(err){ console.error(err); });
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 = "{\"url\":\"https://targetwebsite.com/product_id/\"}";
String res = Executor.newInstance()
.addHeader("Authorization", "Bearer API_TOKEN")
.execute(Request.Post("https://api.brightdata.com/dca/trigger_immediate?collector=ID_COLLECTOR"))
.bodyString(body, ContentType.APPLICATION_JSON))
.returnContent().asString();
System.out.println(res)
}
}
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://api.brightdata.com/dca/trigger_immediate?collector=ID_COLLECTOR"),
Headers = {
{"Authorization", "Bearer API_TOKEN"}
},
Content = new StringContent(JsonConvert.SerializeObject( new {
url = "https://targetwebsite.com/product_id/"
}), Encoding.UTF8, "application/json"))
};
var response = await client.SendAsync(requestMessage);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}
#!/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 = {'url': 'https://targetwebsite.com/product_id/'}
headers = {'Content-Type': 'application/json','Authorization': 'Bearer API_TOKEN'}
r = requests.post('https://api.brightdata.com/dca/trigger_immediate?collector=ID_COLLECTOR', data=data, headers=headers)
print(r.content)