Skip to content
Last updated

Costruire una pipeline (IT)

English version

Questa guida spiega come creare pipeline ETL usando YAML e come eseguirle via API.

WebRobot è un'infrastruttura dati nativa Spark e API-first per costruire pipeline ETL agentiche e prodotti dati. Questo componente ETL fornisce elaborazione dati scalabile, web scraping intelligente e gestione pipeline estendibile.

Struttura del YAML

fetch:                  # opzionale
  url: "https://example.com"
  traces:               # opzionale (azioni browser)
    - { action: "wait", params: { seconds: 1 } }

pipeline:               # obbligatorio
  - stage: join
    args: [ "a.product-link", "LeftOuter" ]
  - stage: extract
    args:
      - { selector: "h1", method: "text", as: "title" }

API: dove “vive” la pipeline

Non esiste un endpoint /webrobot/api/pipelines.

La pipeline YAML viene salvata sull’Agent (pipelineYaml) ed eseguita creando un Job che punta a quell’Agent.

1) Crea/Aggiorna Agent con pipelineYaml

curl -X POST https://api.webrobot.eu/api/webrobot/api/agents \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-agent",
    "categoryId": "1",
    "pipelineYaml": "pipeline:\n  - stage: join\n    args: [\"a.product-link\"]\n  - stage: extract\n    args:\n      - { selector: \"h1\", method: \"text\", as: \"title\" }",
    "enabled": true
  }'

2) Crea Job che usa l’Agent

curl -X POST https://api.webrobot.eu/api/webrobot/api/projects/id/your-project-id/jobs \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{ "name": "my-job", "agentId": "123" }'

3) Esegui Job

curl -X POST https://api.webrobot.eu/api/webrobot/api/projects/id/your-project-id/jobs/your-job-id/execute \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{ "parameters": { "limit": 100 } }'

Approfondimenti