ApifyClient.API.RequestQueues.Head (apify_client v1.0.0)

Copy Markdown View Source

Provides API endpoints related to api/request queues/head

Summary

Functions

Get request queue head

Get and lock request queue head

Functions

get(queue_id, opts \\ [])

@spec get(queue_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.RequestQueueHead.t()}
  | {:error, ApifyClient.Error.t()}

Get request queue head

Returns given number of first requests from the queue.

The response contains the hadMultipleClients boolean field which indicates that the queue was accessed by more than one client (with unique or empty clientKey). This field is used by Apify SDK to determine whether the local cache is consistent with the request queue, and thus optimize performance of certain operations.

Options

  • limit: How many items from queue should be returned.
  • client_key: A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long. This identifier is used to determine whether the queue was accessed by multiple clients. If clientKey is not provided, the system considers this API call to come from a new client. For details, see the hadMultipleClients field returned by the Get request queue head endpoint.

lock(queue_id, opts \\ [])

@spec lock(queue_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.LockedRequestQueueHead.t()}
  | {:error, ApifyClient.Error.t()}

Get and lock request queue head

Returns the given number of first requests from the queue and locks them for the given time.

If this endpoint locks the request, no other client or run will be able to get and lock these requests.

The response contains the hadMultipleClients boolean field which indicates that the queue was accessed by more than one client (with unique or empty clientKey).

Options

  • lock_secs: How long the requests will be locked for (in seconds).
  • limit: How many items from the queue should be returned.
  • client_key: A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long. This identifier is used to determine whether the queue was accessed by multiple clients. If clientKey is not provided, the system considers this API call to come from a new client. For details, see the hadMultipleClients field returned by the Get request queue head endpoint.