Skip to main content

Get head and lock

POST 

https://api.apify.com/v2/request-queues/:queueId/head/lock

ClientsApify API Python Client ReferenceApify API JavaScript Client ReferenceReturns 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).

Request

Path Parameters

    queueId stringrequired

    Queue ID or username~queue-name.

Query Parameters

    lockSecs doublerequired

    How long the requests will be locked for (in seconds).

    limit double

    Possible values: <= 25

    How many items from the queue should be returned.

    clientKey string

    A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long.

Responses

Response Headers
    Schema
      data objectrequired
      limitnumberrequired
      Example: 1000
      queueModifiedAtstringrequired

      The modifiedAt is updated whenever the queue is modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the queue.

      Example: 2018-03-14T23:00:00.000Z
      queueHasLockedRequestsboolean

      Whether the queue contains requests locked by any client (either the one calling the endpoint or a different one).

      Example: true
      clientKeystring
      Example: client-one
      hadMultipleClientsbooleanrequired
      Example: true
      lockSecsnumberrequired
      Example: 60
      items object[]required
    • Array [
    • idstringrequired
      Example: 8OamqXBCpPHxyj9
      retryCountnumberrequired
      Example: 0
      uniqueKeystringrequired
      Example: http://example.com
      urlstringrequired
      Example: http://example.com
      methodstringrequired
      Example: GET
      lockExpiresAtstringrequired
      Example: 2022-06-14T23:00:00.000Z
    • ]

    Authorization: http

    name: httpBearertype: httpscheme: bearerdescription: API authentication token.
    curl -L -X POST 'https://api.apify.com/v2/request-queues/:queueId/head/lock' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer <token>'
    Request Collapse all
    Base URL
    https://api.apify.com
    Auth
    Parameters
    — pathrequired
    — queryrequired
    — query
    — query
    ResponseClear

    Click the Send API Request button above and see the response here!