Locks

sfp server API reference for Locks: 6 endpoints.

POST/sfp/api/locks

Requests a lock on a specific resource within a repository. If the resource is already locked, the request is queued. Returns a ticket ID that can be used to check status, attempt acquisition, or release the lock. Locks automatically expire after the specified duration.

Authorization

access-token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

curl -X POST "https://example.com/sfp/api/locks" \  -H "Content-Type: application/json" \  -d '{    "repository": "string",    "resource": "string",    "leaseDurationSeconds": 0  }'
Empty
DELETE/sfp/api/locks/{repository}/{resource}/{ticketId}

Releases a previously acquired lock using the ticket ID. Only the lock holder or users with owner/application role can release a lock. Once released, the next queued request (if any) will automatically acquire the lock.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

repository*string
resource*string
ticketId*string

Response Body

curl -X DELETE "https://example.com/sfp/api/locks/string/string/string"
Empty
GET/sfp/api/locks/{repository}/{resource}/{ticketId}

Retrieves the current status of a lock request by ticket ID. Returns information including lock status (queued/acquired/released), queue position if queued, lease start time and duration if acquired, and requestor details.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

repository*string
resource*string
ticketId*string

Response Body

application/json

curl -X GET "https://example.com/sfp/api/locks/string/string/string"
{  "id": "string",  "resource": "string",  "ticketId": "string",  "status": "queued",  "queuePosition": 0,  "leaseStart": "2019-08-24T14:15:22Z",  "leaseDurationSeconds": 0,  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}
DELETE/sfp/api/locks/{repository}/{resource}

Force clears all locks (both acquired and queued) for a specific resource. This is a destructive operation that should only be used for recovery scenarios. All waiting requests will be cancelled. Requires owner or application role.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

repository*string
resource*string

Response Body

curl -X DELETE "https://example.com/sfp/api/locks/string/string"
Empty
GET/sfp/api/locks/{repository}/{resource}

Retrieves all lock requests (queued, acquired, and recently released) for a specific resource. Useful for understanding the current lock queue and identifying who holds the lock. Results are ordered by queue position for queued locks.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

repository*string
resource*string

Response Body

application/json

curl -X GET "https://example.com/sfp/api/locks/string/string"
[  {    "id": "string",    "resource": "string",    "ticketId": "string",    "status": "queued",    "queuePosition": 0,    "leaseStart": "2019-08-24T14:15:22Z",    "leaseDurationSeconds": 0,    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }]
POST/sfp/api/locks/{repository}/{resource}/{ticketId}/acquire

Attempts to acquire a previously queued lock. Returns immediately with the result. If the lock is still queued (another lock is active), returns acquired=false. If this lock is now at the front of the queue, it will be acquired and returns acquired=true. Use this endpoint to poll for lock availability.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

repository*string
resource*string
ticketId*string

Response Body

application/json

curl -X POST "https://example.com/sfp/api/locks/string/string/string/acquire"
{  "acquired": true,  "message": "string"}