Skip to main content
PUT
/
api
/
claims
/
{id}
Update Claim
curl --request PUT \
  --url https://harbor-parking.vercel.app/api/claims/{id} \
  --header 'Content-Type: application/json' \
  --data '{
  "status": "<string>",
  "start_time": "<string>",
  "end_time": "<string>"
}'
{
  "claim": {
    "id": "abc123de-e89b-12d3-a456-426614174003",
    "availability_id": "789e0123-e89b-12d3-a456-426614174002",
    "claimer_id": "456e7890-e89b-12d3-a456-426614174001",
    "start_time": "2024-01-16T09:00:00Z",
    "end_time": "2024-01-16T17:00:00Z",
    "status": "completed",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-16T18:00:00Z"
  }
}

Overview

This endpoint allows users to update their claim details, primarily the status.

Authentication

Path Parameters

id
string
required
Unique identifier of the claim to update

Request Body

status
string
Updated claim status (active, completed, cancelled)
start_time
string
Updated claim start time (ISO 8601 format)
end_time
string
Updated claim end time (ISO 8601 format)

Response

claim
object
required
Updated claim object

Example Request

curl -X PUT "https://harbor-parking.vercel.app/api/claims/abc123de-e89b-12d3-a456-426614174003" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "completed"
  }'

Example Response

{
  "claim": {
    "id": "abc123de-e89b-12d3-a456-426614174003",
    "availability_id": "789e0123-e89b-12d3-a456-426614174002",
    "claimer_id": "456e7890-e89b-12d3-a456-426614174001",
    "start_time": "2024-01-16T09:00:00Z",
    "end_time": "2024-01-16T17:00:00Z",
    "status": "completed",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-16T18:00:00Z"
  }
}

Status Transitions

  • active → completed: Mark the parking session as finished
  • active → cancelled: Cancel the claim (frees up the availability)
  • completed/cancelled: No further changes allowed

Error Responses

{
  "error": "Cannot change status from completed/cancelled"
}