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'
});

// Get the extracted data
const response = await result.fetchData({});
console.log(response.data); // Array of extracted items

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: "12313"
});
For more control, you can specify all available options:
const data = await client.extraction.fetchData({
  workflowId: "12313",    // Required: The workflow ID
  runId: "run-456",       // Optional: Fetch data from a specific run
  page: 1,                // Optional: Page number (default: 1)
  limit: 10               // Optional: Items per page (default: 100)
});

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 result.fetchDataPages()) {
  console.log('Page data:', page.data);
  console.log('Page number:', page.pagination.page);
}

// Option 2: Get everything at once
const allData = await result.fetchAllData();
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
  }
}