Create Parking Spot
curl --request POST \
--url https://harbor-parking.vercel.app/api/parking-spots \
--header 'Content-Type: application/json' \
--data '
{
"spot_number": "<string>",
"building_section": "<string>"
}
'import requests
url = "https://harbor-parking.vercel.app/api/parking-spots"
payload = {
"spot_number": "<string>",
"building_section": "<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_number: '<string>', building_section: '<string>'})
};
fetch('https://harbor-parking.vercel.app/api/parking-spots', 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/parking-spots",
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_number' => '<string>',
'building_section' => '<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/parking-spots"
payload := strings.NewReader("{\n \"spot_number\": \"<string>\",\n \"building_section\": \"<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/parking-spots")
.header("Content-Type", "application/json")
.body("{\n \"spot_number\": \"<string>\",\n \"building_section\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/parking-spots")
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_number\": \"<string>\",\n \"building_section\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"spot": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"spot_number": "A-15",
"owner_id": "456e7890-e89b-12d3-a456-426614174001",
"building_section": "Level 2 Parking Garage",
"is_verified": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Parking Spots
Create Parking Spot
Register a new parking spot
POST
/
api
/
parking-spots
Create Parking Spot
curl --request POST \
--url https://harbor-parking.vercel.app/api/parking-spots \
--header 'Content-Type: application/json' \
--data '
{
"spot_number": "<string>",
"building_section": "<string>"
}
'import requests
url = "https://harbor-parking.vercel.app/api/parking-spots"
payload = {
"spot_number": "<string>",
"building_section": "<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_number: '<string>', building_section: '<string>'})
};
fetch('https://harbor-parking.vercel.app/api/parking-spots', 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/parking-spots",
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_number' => '<string>',
'building_section' => '<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/parking-spots"
payload := strings.NewReader("{\n \"spot_number\": \"<string>\",\n \"building_section\": \"<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/parking-spots")
.header("Content-Type", "application/json")
.body("{\n \"spot_number\": \"<string>\",\n \"building_section\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/parking-spots")
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_number\": \"<string>\",\n \"building_section\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"spot": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"spot_number": "A-15",
"owner_id": "456e7890-e89b-12d3-a456-426614174001",
"building_section": "Level 2 Parking Garage",
"is_verified": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Overview
This endpoint allows users to register a new parking spot in the system.Authentication
Request Body
Response
Created parking spot object
Show Spot Object
Show Spot Object
Example Request
curl -X POST "https://harbor-parking.vercel.app/api/parking-spots" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"spot_number": "A-15",
"building_section": "Level 2 Parking Garage"
}'
const response = await fetch('https://harbor-parking.vercel.app/api/parking-spots', {
method: 'POST',
headers: {
'Authorization': `Bearer ${yourJwtToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
spot_number: "A-15",
building_section: "Level 2 Parking Garage"
})
});
const result = await response.json();
Example Response
{
"spot": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"spot_number": "A-15",
"owner_id": "456e7890-e89b-12d3-a456-426614174001",
"building_section": "Level 2 Parking Garage",
"is_verified": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}