可选地获取特定批次的已完成或失败项目列表及其内容
curl --request GET \
--url https://api.olostep.com/v1/batches/{batch_id}/items \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.olostep.com/v1/batches/{batch_id}/items"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.olostep.com/v1/batches/{batch_id}/items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.olostep.com/v1/batches/{batch_id}/items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.olostep.com/v1/batches/{batch_id}/items"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.olostep.com/v1/batches/{batch_id}/items")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/batches/{batch_id}/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"batch_id": "batch_abc123def456",
"object": "list",
"status": "completed",
"items": [
{
"custom_id": "product-123",
"retrieve_id": "ret_xyz789",
"url": "https://example.com/product/123",
"metadata": {
"source": "catalog_sync",
"priority": "high"
}
},
{
"custom_id": "product-456",
"retrieve_id": "ret_abc456",
"url": "https://example.com/product/456"
}
],
"items_count": 2
}{
"id": "error_abc123",
"object": "error",
"code": "validation_error",
"type": "https://docs.olostep.com/api-reference/errors/bad_request",
"status": 400,
"title": "错误请求",
"detail": "Status must be either 'completed' or 'failed'",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "invalid_api_key",
"type": "https://docs.olostep.com/api-reference/errors/unauthorized",
"status": 401,
"title": "未授权",
"detail": "Your API key is invalid",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "batch_not_found",
"type": "https://docs.olostep.com/api-reference/errors/not_found",
"status": 404,
"title": "未找到",
"detail": "Batch not found",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "internal_server_error",
"type": "https://docs.olostep.com/api-reference/errors/internal_error",
"status": 500,
"title": "内部服务器错误",
"detail": "An unexpected error occurred",
"created": 1704067200,
"metadata": {}
}批次
批处理项目
检索批处理中处理的项目列表。然后你可以使用 retrieve_id 通过检索端点获取内容
GET
/
v1
/
batches
/
{batch_id}
/
items
可选地获取特定批次的已完成或失败项目列表及其内容
curl --request GET \
--url https://api.olostep.com/v1/batches/{batch_id}/items \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.olostep.com/v1/batches/{batch_id}/items"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.olostep.com/v1/batches/{batch_id}/items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.olostep.com/v1/batches/{batch_id}/items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.olostep.com/v1/batches/{batch_id}/items"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.olostep.com/v1/batches/{batch_id}/items")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/batches/{batch_id}/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"batch_id": "batch_abc123def456",
"object": "list",
"status": "completed",
"items": [
{
"custom_id": "product-123",
"retrieve_id": "ret_xyz789",
"url": "https://example.com/product/123",
"metadata": {
"source": "catalog_sync",
"priority": "high"
}
},
{
"custom_id": "product-456",
"retrieve_id": "ret_abc456",
"url": "https://example.com/product/456"
}
],
"items_count": 2
}{
"id": "error_abc123",
"object": "error",
"code": "validation_error",
"type": "https://docs.olostep.com/api-reference/errors/bad_request",
"status": 400,
"title": "错误请求",
"detail": "Status must be either 'completed' or 'failed'",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "invalid_api_key",
"type": "https://docs.olostep.com/api-reference/errors/unauthorized",
"status": 401,
"title": "未授权",
"detail": "Your API key is invalid",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "batch_not_found",
"type": "https://docs.olostep.com/api-reference/errors/not_found",
"status": 404,
"title": "未找到",
"detail": "Batch not found",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "internal_server_error",
"type": "https://docs.olostep.com/api-reference/errors/internal_error",
"status": 500,
"title": "内部服务器错误",
"detail": "An unexpected error occurred",
"created": 1704067200,
"metadata": {}
}元数据: 如果你在创建批处理时为各个项目附加了
metadata,它将在响应中随每个项目一起返回。授权
Bearer身份验证头的格式为Bearer ,其中是你的认证令牌。
路径参数
要获取项目的批次ID。
查询参数
要获取的URL状态(已完成或失败)。
可用选项:
completed, failed 返回结果的数量(推荐10-50)。
此页面对您有帮助吗?
⌘I