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": "Mauvaise Requête",
"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 autorisé",
"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": "Paiement Requis",
"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": "Interdit",
"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": "Erreur d'Idempotence",
"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 Traitable",
"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": "Erreur interne du serveur",
"detail": "An unexpected error occurred",
"created": 1704067200,
"metadata": {}
}Créer un lot
Démarre un nouveau lot. Vous recevez un id que vous pouvez utiliser pour suivre la progression du lot comme montré ici. Remarque : Le temps de traitement est constant, quelle que soit la taille du lot
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": "Mauvaise Requête",
"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 autorisé",
"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": "Paiement Requis",
"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": "Interdit",
"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": "Erreur d'Idempotence",
"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 Traitable",
"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": "Erreur interne du serveur",
"detail": "An unexpected error occurred",
"created": 1704067200,
"metadata": {}
}webhook avec l’URL de votre point de terminaison pour recevoir un HTTP POST lorsque le lot est terminé. Voir Webhooks pour plus de détails.metadata pour stocker des paires clé-valeur. Pris en charge à deux niveaux :- Niveau du lot — dans le corps de la requête
- Niveau de l’élément — sur chaque élément dans le tableau
items
Autorisations
En-tête d'authentification Bearer sous la forme Bearer , où est ton jeton d'authentification.
Corps
Tableau d'éléments à traiter dans le lot.
Show child attributes
Show child attributes
Pays pour l'exécution du lot. Fournir en codes ISO 3166-1 alpha-2 comme US(USA), IN(Inde), etc.
Tu peux utiliser ce paramètre pour spécifier l'analyseur à utiliser. Les analyseurs sont utiles pour extraire du contenu structuré à partir de pages web. Olostep a quelques analyseurs intégrés pour les pages web les plus courantes, et tu peux aussi créer tes propres analyseurs.
Show child attributes
Show child attributes
Obtiens tous les liens présents sur chaque page du lot. Les liens sont toujours retournés sous forme d'URLs absolues.
Show child attributes
Show child attributes
Ensemble de paires clé-valeur pour stocker des informations supplémentaires sur un objet. Suit l'approche de Stripe avec des règles de validation : max 50 clés, clé max 40 caractères (pas de crochets), valeur max 500 caractères, toutes les valeurs stockées en tant que chaînes.
Show child attributes
Show child attributes
{
"order_id": "12345",
"customer_name": "John Doe",
"priority": "high",
"processed": "true"
}
URL HTTPS pour recevoir une requête POST lorsque le lot est terminé. Doit être une URL publiquement accessible utilisant le protocole http:// ou https://. Ne peut pas pointer vers localhost ou des adresses IP privées. Voir Webhooks pour le format de la charge utile et le comportement de réessai.
Réponse
Lot démarré avec succès.
ID du lot
Le type d'objet. "batch" pour ce point de terminaison.
in_progress ou completed
Époque créée
Nombre d'URLs dans le lot
Nombre d'URLs complétées
Ensemble de paires clé-valeur pour stocker des informations supplémentaires sur un objet. Suit l'approche de Stripe avec des règles de validation : max 50 clés, clé max 40 caractères (pas de crochets), valeur max 500 caractères, toutes les valeurs stockées en tant que chaînes.
Show child attributes
Show child attributes
{
"order_id": "12345",
"customer_name": "John Doe",
"priority": "high",
"processed": "true"
}
URL de webhook pour recevoir la notification de fin
Nombre de crédits consommés par cette requête. Rempli après l'exécution terminée. Les crédits sont la source de vérité pour la facturation.
Coût estimé en USD pour cette requête. Rempli après l'exécution terminée. Calculé à partir des crédits consommés et de ton tarif de plan — 99% précis, mais credits_consumed est la valeur faisant autorité.
Cette page vous a-t-elle été utile ?