curl --request POST \
--url https://api.olostep.com/v1/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"custom_id": "product-123",
"url": "https://example.com/product/123",
"metadata": {
"source": "catalog_sync",
"priority": "high"
}
},
{
"custom_id": "product-456",
"url": "https://example.com/product/456"
}
],
"country": "US",
"metadata": {
"batch_name": "Q1 Product Sync",
"initiated_by": "automation"
}
}
'import requests
url = "https://api.olostep.com/v1/batches"
payload = {
"items": [
{
"custom_id": "product-123",
"url": "https://example.com/product/123",
"metadata": {
"source": "catalog_sync",
"priority": "high"
}
},
{
"custom_id": "product-456",
"url": "https://example.com/product/456"
}
],
"country": "US",
"metadata": {
"batch_name": "Q1 Product Sync",
"initiated_by": "automation"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{
custom_id: 'product-123',
url: 'https://example.com/product/123',
metadata: {source: 'catalog_sync', priority: 'high'}
},
{custom_id: 'product-456', url: 'https://example.com/product/456'}
],
country: 'US',
metadata: {batch_name: 'Q1 Product Sync', initiated_by: 'automation'}
})
};
fetch('https://api.olostep.com/v1/batches', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'custom_id' => 'product-123',
'url' => 'https://example.com/product/123',
'metadata' => [
'source' => 'catalog_sync',
'priority' => 'high'
]
],
[
'custom_id' => 'product-456',
'url' => 'https://example.com/product/456'
]
],
'country' => 'US',
'metadata' => [
'batch_name' => 'Q1 Product Sync',
'initiated_by' => 'automation'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.olostep.com/v1/batches"
payload := strings.NewReader("{\n \"items\": [\n {\n \"custom_id\": \"product-123\",\n \"url\": \"https://example.com/product/123\",\n \"metadata\": {\n \"source\": \"catalog_sync\",\n \"priority\": \"high\"\n }\n },\n {\n \"custom_id\": \"product-456\",\n \"url\": \"https://example.com/product/456\"\n }\n ],\n \"country\": \"US\",\n \"metadata\": {\n \"batch_name\": \"Q1 Product Sync\",\n \"initiated_by\": \"automation\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.olostep.com/v1/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"custom_id\": \"product-123\",\n \"url\": \"https://example.com/product/123\",\n \"metadata\": {\n \"source\": \"catalog_sync\",\n \"priority\": \"high\"\n }\n },\n {\n \"custom_id\": \"product-456\",\n \"url\": \"https://example.com/product/456\"\n }\n ],\n \"country\": \"US\",\n \"metadata\": {\n \"batch_name\": \"Q1 Product Sync\",\n \"initiated_by\": \"automation\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"custom_id\": \"product-123\",\n \"url\": \"https://example.com/product/123\",\n \"metadata\": {\n \"source\": \"catalog_sync\",\n \"priority\": \"high\"\n }\n },\n {\n \"custom_id\": \"product-456\",\n \"url\": \"https://example.com/product/456\"\n }\n ],\n \"country\": \"US\",\n \"metadata\": {\n \"batch_name\": \"Q1 Product Sync\",\n \"initiated_by\": \"automation\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "batch_abc123def456",
"object": "batch",
"status": "in_progress",
"created": 1704067200,
"total_urls": 2,
"completed_urls": 0,
"country": "US",
"metadata": {
"batch_name": "Q1 Product Sync",
"initiated_by": "automation"
}
}{
"id": "error_abc123",
"object": "error",
"code": "validation_error",
"type": "https://docs.olostep.com/api-reference/errors/bad_request",
"status": 400,
"title": "Richiesta Errata",
"detail": "The 'items' array is required and must contain at least one item.",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "invalid_api_key",
"type": "https://docs.olostep.com/api-reference/errors/unauthorized",
"status": 401,
"title": "Non autorizzato",
"detail": "Your API key is invalid. Try double-checking it or reaching out to info@olostep.com if you're facing issues.",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "credits_exhausted",
"type": "https://docs.olostep.com/api-reference/errors/payment_required",
"status": 402,
"title": "Pagamento Richiesto",
"detail": "You have consumed all available credits. Please upgrade your plan from the dashboard: https://www.olostep.com/auth/",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "access_denied",
"type": "https://docs.olostep.com/api-reference/errors/forbidden",
"status": 403,
"title": "Vietato",
"detail": "You don't have access to this feature. Please reach out to info@olostep.com to get approved",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "idempotency_key_in_progress",
"type": "https://docs.olostep.com/api-reference/errors/idempotency_error",
"status": 409,
"title": "Errore di Idempotenza",
"detail": "A request with this idempotency key is currently being processed. Please wait and retry.",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "idempotency_key_reuse",
"type": "https://docs.olostep.com/api-reference/errors/unprocessable_entity",
"status": 422,
"title": "Entità Non Elaborabile",
"detail": "A request with this idempotency key was already made with different parameters. Idempotency keys must be unique per request.",
"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": "Errore Interno del Server",
"detail": "An unexpected error occurred",
"created": 1704067200,
"metadata": {}
}Crea Batch
Avvia un nuovo batch. Ricevi un id che puoi utilizzare per tracciare il progresso del batch come mostrato qui. Nota: Il tempo di elaborazione è costante indipendentemente dalla dimensione del batch
curl --request POST \
--url https://api.olostep.com/v1/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"custom_id": "product-123",
"url": "https://example.com/product/123",
"metadata": {
"source": "catalog_sync",
"priority": "high"
}
},
{
"custom_id": "product-456",
"url": "https://example.com/product/456"
}
],
"country": "US",
"metadata": {
"batch_name": "Q1 Product Sync",
"initiated_by": "automation"
}
}
'import requests
url = "https://api.olostep.com/v1/batches"
payload = {
"items": [
{
"custom_id": "product-123",
"url": "https://example.com/product/123",
"metadata": {
"source": "catalog_sync",
"priority": "high"
}
},
{
"custom_id": "product-456",
"url": "https://example.com/product/456"
}
],
"country": "US",
"metadata": {
"batch_name": "Q1 Product Sync",
"initiated_by": "automation"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{
custom_id: 'product-123',
url: 'https://example.com/product/123',
metadata: {source: 'catalog_sync', priority: 'high'}
},
{custom_id: 'product-456', url: 'https://example.com/product/456'}
],
country: 'US',
metadata: {batch_name: 'Q1 Product Sync', initiated_by: 'automation'}
})
};
fetch('https://api.olostep.com/v1/batches', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'custom_id' => 'product-123',
'url' => 'https://example.com/product/123',
'metadata' => [
'source' => 'catalog_sync',
'priority' => 'high'
]
],
[
'custom_id' => 'product-456',
'url' => 'https://example.com/product/456'
]
],
'country' => 'US',
'metadata' => [
'batch_name' => 'Q1 Product Sync',
'initiated_by' => 'automation'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.olostep.com/v1/batches"
payload := strings.NewReader("{\n \"items\": [\n {\n \"custom_id\": \"product-123\",\n \"url\": \"https://example.com/product/123\",\n \"metadata\": {\n \"source\": \"catalog_sync\",\n \"priority\": \"high\"\n }\n },\n {\n \"custom_id\": \"product-456\",\n \"url\": \"https://example.com/product/456\"\n }\n ],\n \"country\": \"US\",\n \"metadata\": {\n \"batch_name\": \"Q1 Product Sync\",\n \"initiated_by\": \"automation\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.olostep.com/v1/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"custom_id\": \"product-123\",\n \"url\": \"https://example.com/product/123\",\n \"metadata\": {\n \"source\": \"catalog_sync\",\n \"priority\": \"high\"\n }\n },\n {\n \"custom_id\": \"product-456\",\n \"url\": \"https://example.com/product/456\"\n }\n ],\n \"country\": \"US\",\n \"metadata\": {\n \"batch_name\": \"Q1 Product Sync\",\n \"initiated_by\": \"automation\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"custom_id\": \"product-123\",\n \"url\": \"https://example.com/product/123\",\n \"metadata\": {\n \"source\": \"catalog_sync\",\n \"priority\": \"high\"\n }\n },\n {\n \"custom_id\": \"product-456\",\n \"url\": \"https://example.com/product/456\"\n }\n ],\n \"country\": \"US\",\n \"metadata\": {\n \"batch_name\": \"Q1 Product Sync\",\n \"initiated_by\": \"automation\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "batch_abc123def456",
"object": "batch",
"status": "in_progress",
"created": 1704067200,
"total_urls": 2,
"completed_urls": 0,
"country": "US",
"metadata": {
"batch_name": "Q1 Product Sync",
"initiated_by": "automation"
}
}{
"id": "error_abc123",
"object": "error",
"code": "validation_error",
"type": "https://docs.olostep.com/api-reference/errors/bad_request",
"status": 400,
"title": "Richiesta Errata",
"detail": "The 'items' array is required and must contain at least one item.",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "invalid_api_key",
"type": "https://docs.olostep.com/api-reference/errors/unauthorized",
"status": 401,
"title": "Non autorizzato",
"detail": "Your API key is invalid. Try double-checking it or reaching out to info@olostep.com if you're facing issues.",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "credits_exhausted",
"type": "https://docs.olostep.com/api-reference/errors/payment_required",
"status": 402,
"title": "Pagamento Richiesto",
"detail": "You have consumed all available credits. Please upgrade your plan from the dashboard: https://www.olostep.com/auth/",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "access_denied",
"type": "https://docs.olostep.com/api-reference/errors/forbidden",
"status": 403,
"title": "Vietato",
"detail": "You don't have access to this feature. Please reach out to info@olostep.com to get approved",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "idempotency_key_in_progress",
"type": "https://docs.olostep.com/api-reference/errors/idempotency_error",
"status": 409,
"title": "Errore di Idempotenza",
"detail": "A request with this idempotency key is currently being processed. Please wait and retry.",
"created": 1704067200,
"metadata": {}
}{
"id": "error_abc123",
"object": "error",
"code": "idempotency_key_reuse",
"type": "https://docs.olostep.com/api-reference/errors/unprocessable_entity",
"status": 422,
"title": "Entità Non Elaborabile",
"detail": "A request with this idempotency key was already made with different parameters. Idempotency keys must be unique per request.",
"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": "Errore Interno del Server",
"detail": "An unexpected error occurred",
"created": 1704067200,
"metadata": {}
}webhook con l’URL del tuo endpoint per ricevere un HTTP POST quando il batch è completato. Vedi Webhooks per i dettagli.metadata per memorizzare coppie chiave-valore. Supportato a due livelli:- Livello batch — nel corpo della richiesta
- Livello elemento — su ciascun elemento nell’array
items
Autorizzazioni
Intestazione di autenticazione Bearer del tipo Bearer , dove è il tuo token di autenticazione.
Corpo
Array di elementi da elaborare nel batch.
Show child attributes
Show child attributes
Paese per l'esecuzione del batch. Fornisci in codici ISO 3166-1 alpha-2 come US(Stati Uniti), IN(India), ecc.
Puoi usare questo parametro per specificare il parser da usare. I parser sono utili per estrarre contenuti strutturati dalle pagine web. Olostep ha alcuni parser integrati per le pagine web più comuni, e puoi anche creare i tuoi parser.
Show child attributes
Show child attributes
Ottieni tutti i link presenti su ogni pagina nel batch. I link sono sempre restituiti come URL assoluti.
Show child attributes
Show child attributes
Insieme di coppie chiave-valore per memorizzare informazioni aggiuntive su un oggetto. Segue l'approccio di Stripe con regole di validazione: massimo 50 chiavi, chiave massimo 40 caratteri (senza parentesi quadre), valore massimo 500 caratteri, tutti i valori memorizzati come stringhe.
Show child attributes
Show child attributes
{
"order_id": "12345",
"customer_name": "John Doe",
"priority": "high",
"processed": "true"
}
Risposta
Batch avviato con successo.
ID del Batch
Il tipo di oggetto. "batch" per questo endpoint.
in_progress o completed
Epoch creato
Conteggio degli URL nel batch
Conteggio degli URL completati
Insieme di coppie chiave-valore per memorizzare informazioni aggiuntive su un oggetto. Segue l'approccio di Stripe con regole di validazione: massimo 50 chiavi, chiave massimo 40 caratteri (senza parentesi quadre), valore massimo 500 caratteri, tutti i valori memorizzati come stringhe.
Show child attributes
Show child attributes
{
"order_id": "12345",
"customer_name": "John Doe",
"priority": "high",
"processed": "true"
}
URL del webhook per ricevere la notifica di completamento
Numero di crediti consumati da questa richiesta. Popolato dopo il completamento dell'esecuzione. I crediti sono la fonte di verità per la fatturazione.
Costo stimato in USD per questa richiesta. Popolato dopo il completamento dell'esecuzione. Calcolato dai crediti consumati e dalla tua tariffa del piano — 99% accurato, ma credits_consumed è il valore autorevole.
Questa pagina è stata utile?