更新采集 URLs
curl --request POST \
--url https://openapi.bazhuayu.com/task/urls:file \
--header 'Authorization: <authorization>' \
--header 'Content-Type: multipart/form-data' \
--form 'taskId=<string>' \
--form file='@example-file'import requests
url = "https://openapi.bazhuayu.com/task/urls:file"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "taskId": "<string>" }
headers = {"Authorization": "<authorization>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('taskId', '<string>');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
options.body = form;
fetch('https://openapi.bazhuayu.com/task/urls:file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('taskId', '<string>');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
options.body = form;
fetch('https://openapi.bazhuayu.com/task/urls:file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.bazhuayu.com/task/urls:file"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.bazhuayu.com/task/urls:file")
.header("Authorization", "<authorization>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openapi.bazhuayu.com/task/urls:file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://openapi.bazhuayu.com/task/urls:file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://openapi.bazhuayu.com/task/urls:file");
var client = new RestClient(options);
var request = new RestRequest("");
request.AlwaysMultipartFormData = true;
request.AddHeader("Authorization", "<authorization>");
request.FormBoundary = "---011000010111000001101001";
request.AddParameter("taskId", "<string>");
request.AddFile("file", "example-file");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
val request = Request.Builder()
.url("https://openapi.bazhuayu.com/task/urls:file")
.post(body)
.addHeader("Authorization", "<authorization>")
.build()
val response = client.newCall(request).execute()false任务
更新采集 URLs
POST
/
task
/
urls:file
更新采集 URLs
curl --request POST \
--url https://openapi.bazhuayu.com/task/urls:file \
--header 'Authorization: <authorization>' \
--header 'Content-Type: multipart/form-data' \
--form 'taskId=<string>' \
--form file='@example-file'import requests
url = "https://openapi.bazhuayu.com/task/urls:file"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "taskId": "<string>" }
headers = {"Authorization": "<authorization>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('taskId', '<string>');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
options.body = form;
fetch('https://openapi.bazhuayu.com/task/urls:file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('taskId', '<string>');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
options.body = form;
fetch('https://openapi.bazhuayu.com/task/urls:file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.bazhuayu.com/task/urls:file"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.bazhuayu.com/task/urls:file")
.header("Authorization", "<authorization>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openapi.bazhuayu.com/task/urls:file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://openapi.bazhuayu.com/task/urls:file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://openapi.bazhuayu.com/task/urls:file");
var client = new RestClient(options);
var request = new RestRequest("");
request.AlwaysMultipartFormData = true;
request.AddHeader("Authorization", "<authorization>");
request.FormBoundary = "---011000010111000001101001";
request.AddParameter("taskId", "<string>");
request.AddFile("file", "example-file");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"taskId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
val request = Request.Builder()
.url("https://openapi.bazhuayu.com/task/urls:file")
.post(body)
.addHeader("Authorization", "<authorization>")
.build()
val response = client.newCall(request).execute()false所需套餐: 旗舰+、企业版、团队版
端点
POST https://openapi.bazhuayu.com/task/urls:file
描述
将采集的网址替换请求头
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
Authorization | String | 是 | 身份令牌 |
Content-Type | String | 是 | multipart/form-data(需包含 boundary,由客户端自动生成,请勿手动写死) |
{
"Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImdXS3hWc0F4SHhaMDlDcWh6NkNJb3ciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MzY0NjIyNzAsImV4cCI6MTYzNjU0ODY2OSwiaXNzIjoiaHR0cDovL3Rlc3QuaWRlbnRpdHkuYmF6aHVheXUuY29tIiwiY2xpZW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L0ojbnt3ck2rQ9tIFuSd7j2eh5BS4ItjNoHY00rh_QPZltk66a9q-fNE33GrxOaXUdHH47WMlsENnh1gybB7QtGtd6bZ982Qa9JljpFnZWSdEf4VfkN4JmhkUTTC908DqS3stT-LD-9tpztFwB54sd0D4CyOBnESkKrUwjxchYYZo4l1O7auiZVGV48YhZYMw",
"Content-Type": "multipart/form-data"
}
请求体
使用multipart/form-data 提交表单字段:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
taskId | String | 是 | 任务 Id(表单字段) |
file | File | 是 | urls 文件:包含网址列表的文本文件(每行一个 URL) |
curl -X POST "https://openapi.bazhuayu.com/task/urls:file" \
-H "Authorization: Bearer <access_token>" \
-F "taskId=a3b9bdf7-9aaa-22f6-9ccf-b32790f6df8f" \
-F "file=@urls.txt"
响应
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
requestId | String | 是 | 请求Id |
data | Object | 是 | 响应数据 |
{
"data": null,
"requestId": "0HMCVDHG1V3E6:00000002"
}
错误响应
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
requestId | String | 是 | 请求Id |
error | Object | 是 | 错误信息,参考错误码 |
code | String | 是 | 错误码 |
message | String | 是 | 错误描述 |
{
"error": {
"code": "InvalidTaskId",
"message": "无效的任务Id"
},
"requestId": "0HMCVDHG1V3E6:00000002"
}
⌘I
