Skip to main content

Basic Usage

Retrieve your data using the SDK’s built-in methods.
const result = await client.extraction.run({
  urls: ["https://sandbox.kadoa.com/ecommerce"],
  name: "Product Extraction",
});

// Data is included in the result
console.log(result.data); // Array of extracted items
console.log(result.pagination); // { page, limit, total, totalPages }

Fetch Data

If you have an existing workflow, you can fetch its data directly using the workflow ID:
// Simplest way to fetch workflow data
const data = await client.extraction.fetchData({
  workflowId: workflowId,
});
console.log(data.data);
For more control, you can specify all available options:
const data = await client.extraction.fetchData({
  workflowId: workflowId,
  page: 1,
  limit: 10,
});

console.log(data.data); // Array of extracted items
console.log(data.pagination); // { page, limit, total, totalPages }

Pagination

Handle large datasets efficiently using the SDK’s pagination methods:
// Option 1: Iterate page by page
for await (const page of client.extraction.fetchDataPages({
  workflowId: workflowId,
})) {
  console.log("Page data:", page.data);
  console.log("Page number:", page.pagination.page);
}

// Option 2: Get everything at once
const allData = await client.extraction.fetchAllData({
  workflowId: workflowId,
});
console.log("All data:", allData);

Response Format

Data returned by the SDK follows this structure:
{
  data: [
    {
      // Your extracted fields
      title: "Product Name",
      price: "$99.99",
      inStock: true
    }
  ],
  pagination: {
    page: 1,
    limit: 50,
    total: 150,
    totalPages: 3
  }
}