Create Station
Create a new station.
Endpoint
INFO
POST /api/v1/dashboard/stations
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
Authorization | Bearer {token} | Yes |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
agency_id | integer | Yes | Agency ID |
name | string | Yes | Station name |
address | string | Yes | Physical address |
latitude | decimal | Yes | Location latitude |
longitude | decimal | Yes | Location longitude |
phone | string | No | Contact phone |
email | string | No | Contact email |
operating_hours | object | No | Operating hours by day |
amenities | array | No | List of amenities |
Example Request
bash
curl -X POST https://api.daakey.com/api/v1/dashboard/stations \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"agency_id": 1,
"name": "Midtown Station",
"address": "456 5th Ave, New York, NY",
"latitude": 40.7549,
"longitude": -73.9840,
"operating_hours": {
"monday": "06:00-22:00",
"tuesday": "06:00-22:00",
"wednesday": "06:00-22:00",
"thursday": "06:00-22:00",
"friday": "06:00-23:00",
"saturday": "07:00-23:00",
"sunday": "07:00-21:00"
},
"amenities": ["parking", "charging", "restroom"]
}'Response
Success (201)
json
{
"success": true,
"message": "Station created successfully",
"data": {
"id": 3,
"name": "Midtown Station",
"address": "456 5th Ave, New York, NY",
"latitude": 40.7549,
"longitude": -73.9840,
"agency": {
"id": 1,
"name": "Downtown Agency"
},
"status": "active",
"operating_hours": {
"monday": "06:00-22:00",
"tuesday": "06:00-22:00",
"wednesday": "06:00-22:00",
"thursday": "06:00-22:00",
"friday": "06:00-23:00",
"saturday": "07:00-23:00",
"sunday": "07:00-21:00"
},
"amenities": ["parking", "charging", "restroom"],
"created_at": "2024-01-15T00:00:00Z"
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}