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>"
}
'import requests
url = "https://harbor-parking.vercel.app/api/claims/{id}"
payload = {
"status": "<string>",
"start_time": "<string>",
"end_time": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({status: '<string>', start_time: '<string>', end_time: '<string>'})
};
fetch('https://harbor-parking.vercel.app/api/claims/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://harbor-parking.vercel.app/api/claims/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'status' => '<string>',
'start_time' => '<string>',
'end_time' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://harbor-parking.vercel.app/api/claims/{id}"
payload := strings.NewReader("{\n \"status\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://harbor-parking.vercel.app/api/claims/{id}")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/claims/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"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"
}
}
Claims
Update Claim
Update claim status or details
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>"
}
'import requests
url = "https://harbor-parking.vercel.app/api/claims/{id}"
payload = {
"status": "<string>",
"start_time": "<string>",
"end_time": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({status: '<string>', start_time: '<string>', end_time: '<string>'})
};
fetch('https://harbor-parking.vercel.app/api/claims/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://harbor-parking.vercel.app/api/claims/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'status' => '<string>',
'start_time' => '<string>',
'end_time' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://harbor-parking.vercel.app/api/claims/{id}"
payload := strings.NewReader("{\n \"status\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://harbor-parking.vercel.app/api/claims/{id}")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/claims/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"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
Request Body
Response
Updated claim object
Show Claim Object
Show 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"
}'
const claimId = "abc123de-e89b-12d3-a456-426614174003";
const response = await fetch(`https://harbor-parking.vercel.app/api/claims/${claimId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${yourJwtToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: "completed"
})
});
const result = await response.json();
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"
}
{
"error": "You can only update your own claims"
}