| id | single-and-collection-clients |
|---|---|
| title | Single and collection clients |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock';
import CollectionAsyncExample from '!!raw-loader!./code/02_collection_async.py'; import CollectionSyncExample from '!!raw-loader!./code/02_collection_sync.py'; import SingleAsyncExample from '!!raw-loader!./code/02_single_async.py'; import SingleSyncExample from '!!raw-loader!./code/02_single_sync.py';
The Apify client interface is designed to be consistent and intuitive across all of its components. When you call specific methods on the main client, you create specialized clients to manage individual API resources. There are two main types of clients:
ActorClient- Manages a single resource.ActorCollectionClient- Manages a collection of resources.
The resource ID can be the resource's id or a combination of username/resource-name.
By utilizing the appropriate collection or resource client, you can simplify how you interact with the Apify API.