Create Availability
curl --request POST \
--url https://harbor-parking.vercel.app/api/availabilities \
--header 'Content-Type: application/json' \
--data '
{
"spot_id": "<string>",
"start_time": "<string>",
"end_time": "<string>"
}
'import requests
url = "https://harbor-parking.vercel.app/api/availabilities"
payload = {
"spot_id": "<string>",
"start_time": "<string>",
"end_time": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({spot_id: '<string>', start_time: '<string>', end_time: '<string>'})
};
fetch('https://harbor-parking.vercel.app/api/availabilities', 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/availabilities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'spot_id' => '<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/availabilities"
payload := strings.NewReader("{\n \"spot_id\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://harbor-parking.vercel.app/api/availabilities")
.header("Content-Type", "application/json")
.body("{\n \"spot_id\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/availabilities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"spot_id\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"availability": {
"id": "789e0123-e89b-12d3-a456-426614174002",
"spot_id": "123e4567-e89b-12d3-a456-426614174000",
"start_time": "2024-01-16T09:00:00Z",
"end_time": "2024-01-16T17:00:00Z",
"is_claimed": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Availabilities
Create Availability
Set a parking spot availability window
POST
/
api
/
availabilities
Create Availability
curl --request POST \
--url https://harbor-parking.vercel.app/api/availabilities \
--header 'Content-Type: application/json' \
--data '
{
"spot_id": "<string>",
"start_time": "<string>",
"end_time": "<string>"
}
'import requests
url = "https://harbor-parking.vercel.app/api/availabilities"
payload = {
"spot_id": "<string>",
"start_time": "<string>",
"end_time": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({spot_id: '<string>', start_time: '<string>', end_time: '<string>'})
};
fetch('https://harbor-parking.vercel.app/api/availabilities', 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/availabilities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'spot_id' => '<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/availabilities"
payload := strings.NewReader("{\n \"spot_id\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://harbor-parking.vercel.app/api/availabilities")
.header("Content-Type", "application/json")
.body("{\n \"spot_id\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/availabilities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"spot_id\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"availability": {
"id": "789e0123-e89b-12d3-a456-426614174002",
"spot_id": "123e4567-e89b-12d3-a456-426614174000",
"start_time": "2024-01-16T09:00:00Z",
"end_time": "2024-01-16T17:00:00Z",
"is_claimed": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Overview
This endpoint allows parking spot owners to create availability windows for their spots.Authentication
Request Body
string
required
ID of the parking spot to make available
string
required
Availability start time (ISO 8601 format)
string
required
Availability end time (ISO 8601 format)
Response
object
required
Created availability object
Show Availability Object
Show Availability Object
string
required
Unique availability identifier (UUID)
string
required
ID of the associated parking spot
string
required
Availability start time (ISO 8601)
string
required
Availability end time (ISO 8601)
boolean
required
Whether this availability has been claimed (always false on creation)
string
required
Availability creation timestamp (ISO 8601)
string
required
Availability last update timestamp (ISO 8601)
Example Request
curl -X POST "https://harbor-parking.vercel.app/api/availabilities" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"spot_id": "123e4567-e89b-12d3-a456-426614174000",
"start_time": "2024-01-16T09:00:00Z",
"end_time": "2024-01-16T17:00:00Z"
}'
const response = await fetch('https://harbor-parking.vercel.app/api/availabilities', {
method: 'POST',
headers: {
'Authorization': `Bearer ${yourJwtToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
spot_id: "123e4567-e89b-12d3-a456-426614174000",
start_time: "2024-01-16T09:00:00Z",
end_time: "2024-01-16T17:00:00Z"
})
});
const result = await response.json();
Example Response
{
"availability": {
"id": "789e0123-e89b-12d3-a456-426614174002",
"spot_id": "123e4567-e89b-12d3-a456-426614174000",
"start_time": "2024-01-16T09:00:00Z",
"end_time": "2024-01-16T17:00:00Z",
"is_claimed": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Validation Rules
start_timemust be in the futureend_timemust be afterstart_time- You can only create availabilities for spots you own
- Availability windows cannot overlap with existing ones for the same spot