Skip to main content
Version: Next

DatasetCollectionClient

Client for managing the collection of datasets in your account.

Datasets store structured data results from Actor runs. This client provides methods to list, create, or get datasets by name.

@example
const client = new ApifyClient({ token: 'my-token' });
const datasetsClient = client.datasets();

// List all datasets
const { items } = await datasetsClient.list();

// Get or create a dataset by name
const dataset = await datasetsClient.getOrCreate('my-dataset');
@see

Hierarchy

  • ResourceCollectionClient
    • DatasetCollectionClient

Index

Properties

inheritedapifyClient

apifyClient: ApifyClient

inheritedbaseUrl

baseUrl: string

inheritedhttpClient

httpClient: HttpClient

optionalinheritedid

id?: string

optionalinheritedparams

params?: Record<string, unknown>

inheritedpublicBaseUrl

publicBaseUrl: string

inheritedresourcePath

resourcePath: string

optionalinheritedsafeId

safeId?: string

inheritedurl

url: string

Methods

getOrCreate

  • getOrCreate(name, options): Promise<Dataset>

list

  • Lists all Datasets.

    Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched items in a single API call is limited.

    const paginatedList = await client.list(options);

    Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are retrieved.

    for await (const singleItem of client.list(options)) {...}
    @see

    Parameters

    Returns Promise<DatasetCollectionClientListResult> & AsyncIterable<Dataset, any, any>

    A paginated iterator of Datasets.