Distributed Lock API reference

    This endpoint lets you acquire a lock by supplying a named lock owner and the resource ID to lock.

    URL Parameters

    Query Parameters

    None

    HTTP Response codes

    CodeDescription
    200Request successful
    204Empty Response
    400Malformed request
    500Request failed

    HTTP Request Body

    1. {
    2. "resourceId": "",
    3. "lockOwner": "",
    4. "expiryInSeconds": 0
    5. }

    The lock endpoint returns the following payload:

    Examples

    1. curl -X POST http://localhost:3500/v1.0-alpha/lock/redisStore \
    2. -H "Content-Type: application/json" \
    3. -d '{
    4. "resourceId": "lock1",
    5. "expiryInSeconds": 60
    6. }'
    7. "success": "true"
    8. }

    Unlock

    This endpoint lets you unlock an existing lock based on the lock owner and resource Id

    HTTP Request

    URL Parameters

    ParameterDescription
    daprPortThe Dapr port
    storenameThe metadata.name field component file. Refer to the

    Query Parameters

    HTTP Request Body

    The unlock endpoint receives the following JSON payload:

    1. {
    2. "resourceId": "",
    3. }

    HTTP Response Body

    The unlock endpoint returns the following payload:

    CodeDescription
    0Success
    1Lock doesn’t exist
    2Lock belongs to another owner
    3Internal error
    1. curl -X POST http://localhost:3500/v1.0-alpha/unlock/redisStore \
    2. -H "Content-Type: application/json" \
    3. -d '{
    4. "resourceId": "lock1",
    5. "lockOwner": "vader"
    6. }'
    7. {