Saltar al contenido principal

Failure Report

This endpoint provides information about failed parking operations and their reasons for a specific parking location within a given time period.

Description

The Failure report helps you track and analyze unsuccessful parking operations, such as when a parking space was not available during the requested time slot. This information is valuable for identifying patterns in booking failures and improving the parking service.

Endpoint

POST /api/v3/business/report/fail

Authentication

This endpoint requires authentication using a Bearer token.

Headers

KeyValue
AuthorizationBearer Token

Request Parameters

Body

{
"parkingId": 151, // ID of the parking location
"from": "2025-05-01T04:00:00.000Z", // Start date and time (UTC)
"until": "2025-05-31T03:59:59.999Z" // End date and time (UTC)
}
ParameterTypeDescription
parkingIdnumberUnique identifier of the parking location
fromstringStart date and time in ISO 8601 format (UTC)
untilstringEnd date and time in ISO 8601 format (UTC)

Response

The response is an array of failure records.

Success Response (200 OK)

[
{
"id": 34238, // Record ID
"userId": 322, // User ID who attempted the operation
"dayis": "2025-05-01T19:56:50.663Z", // Date and time of the failure
"email": "email@example.com", // User's email
"ParkingName": "Estacionamiento Prueba", // Name of the parking location
"City": "Santiago", // City where the parking is located
"description": "Parking no disponible en horario seleccionado" // Reason for failure
}
]

Response Fields

FieldTypeDescription
idnumberUnique identifier for the failure record
userIdnumberID of the user who attempted the operation
dayisstringTimestamp of the failure in ISO 8601 format
emailstringEmail address of the user
ParkingNamestringName of the parking location
CitystringCity where the parking is located
descriptionstringDescription of why the operation failed

Example Usage

cURL

curl -X POST \
'https://api.example.com/api/v3/business/report/fail' \
-H 'Authorization: Bearer your_token_here' \
-H 'Content-Type: application/json' \
-d '{
"parkingId": 151,
"from": "2025-05-01T04:00:00.000Z",
"until": "2025-05-31T03:59:59.999Z"
}'

JavaScript

const response = await fetch('https://api.example.com/api/v3/business/report/fail', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_token_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
parkingId: 151,
from: '2025-05-01T04:00:00.000Z',
until: '2025-05-31T03:59:59.999Z'
})
});

const data = await response.json();

Error Responses

400 Bad Request

{
"error": "Invalid date range"
}

401 Unauthorized

{
"error": "Invalid or missing authentication token"
}

404 Not Found

{
"error": "Parking location not found"
}