Skip to content

API Documentation

Bouchra Akl edited this page May 22, 2023 · 6 revisions

Table of Contents

Introduction

The Parking Management System API provides a comprehensive set of endpoints and functionality to manage parking operations efficiently. It serves as a bridge between your parking management system and external applications, allowing seamless integration and automation of parking-related processes. This API documentation will guide developers on how to interact with the API, outlining its purpose and main features.

Purpose

The purpose of the Parking Management System API is to enable developers to interact with the parking management system programmatically. By integrating with the API, developers can create innovative solutions that enhance parking operations, improve user experience, and streamline administrative tasks.

Modelo

URL Base Endpoint

 http://localhost:8080/api/modelo 

Modelo GET Endpoints

GET Modelo by ID

  http://localhost:8080/api/modelo?id=1
  • Description: Retrieves a specific modelo by its ID.

  • Query Params

    Parameter Type Description
    id int The ID of the model
  • Success Response

      HTTP/1.1 200 OK
     Content-Type: application/json
     {
      "id": 1,
      "cadastro": "2023-05-19T19:12:33.926351",
      "atualizacao": null,
      "ativo": false,
      "nome": "MODELO X",
      "marca": {
          "id": 1,
          "cadastro": "2023-05-19T19:12:29.813295",
          "atualizacao": null,
          "ativo": false,
          "nome": "MARCA X"
      }
     }
    1. id: The ID of the model.
    2. cadastro: The timestamp when the modelo was created.
    3. atualizacao: The timestamp when the modelo was last updated (null if never updated).
    4. ativo: Indicates whether the modelo is active (true) or inactive (false).
    5. nome: The name of the model.
    6. marca: The brand associated with the modelo, including its ID, cadastro, atualizacao, ativo, and nome.
  • Failure Responses

    Status Code Content-Type Response Body
    404 application/json {"error": "Model not found", "message": "The requested model does not exist.", "status": 404}
    500 application/json {"error": "Internal Server Error", "message": "An unexpected error occurred.", "status": 500}
    503 application/json {"error": "Service Unavailable", "message": "The service is currently unavailable.", "status": 503}

GET Modelo by Ativo

  http://localhost:8080/api/modelo/ativos
  • Description: Retrieves the list of active modelos.

  • Success Response

      HTTP/1.1 200 OK
     Content-Type: application/json
     [
     {
      "id": 1,
      "cadastro": "2023-05-19T19:12:33.926351",
      "atualizacao": null,
      "ativo": true,
      "nome": "MODELO X",
      "marca": {
        "id": 1,
        "cadastro": "2023-05-19T19:12:29.813295",
        "atualizacao": null,
        "ativo": true,
        "nome": "MARCA X"
      }
      },
     {
      "id": 2,
      "cadastro": "2023-05-20T10:30:45.456123",
      "atualizacao": null,
      "ativo": true,
      "nome": "MODELO Y",
      "marca": {
        "id": 2,
        "cadastro": "2023-05-20T10:30:00.123456",
        "atualizacao": null,
        "ativo": true,
        "nome": "MARCA Y"
      }
      }
      ]
    
  • Failure Responses

    Status Code Content-Type Response Body
    500 application/json {"error": "Internal Server Error", "message": "An unexpected error occurred.", "status": 500}
    503 application/json {"error": "Service Unavailable", "message": "The service is currently unavailable.", "status": 503}

GET Modelo by All

  http://localhost:8080/api/modelo/all
  • Description: Retrieves all modelos.

  • Success Response

      HTTP/1.1 200 OK
     Content-Type: application/json
     [
     {
      "id": 1,
      "cadastro": "2023-05-19T19:12:33.926351",
      "atualizacao": null,
      "ativo": false,
      "nome": "MODELO X",
      "marca": {
        "id": 1,
        "cadastro": "2023-05-19T19:12:29.813295",
        "atualizacao": null,
        "ativo": false,
        "nome": "MARCA X"
      }
      },
     {
      "id": 2,
      "cadastro": "2023-05-20T10:30:45.456123",
      "atualizacao": null,
      "ativo": true,
      "nome": "MODELO Y",
      "marca": {
        "id": 2,
        "cadastro": "2023-05-20T10:30:00.123456",
        "atualizacao": null,
        "ativo": true,
        "nome": "MARCA Y"
      }
      }
      ]
    
  • Failure Responses

    Status Code Content-Type Response Body
    500 application/json {"error": "Internal Server Error", "message": "An unexpected error occurred.", "status": 500}
    503 application/json {"error": "Service Unavailable", "message": "The service is currently unavailable.", "status": 503}

Modelo POST Endpoint

  http://localhost:8080/api/modelo
  • Description: Creates a new modelo.

  • Body

    • Content type : application/json
    {
     "cadastro": "2023-05-19T18:43:00",
     "nome": "MODELO X",
     "marca": {
         "id": 1
     }
     }
  • Success Response

     HTTP/1.1 201 Created
     Content-Type: application/json
    
     {
       "id": 3,
       "cadastro": "2023-05-19T18:43:00",
       "atualizacao": null,
       "ativo": false,
       "nome": "MODELO X",
       "marca": {
           "id": 1,
           "cadastro": "2023-05-19T19:12:29.813295",
           "atualizacao": null,
           "ativo": false,
           "nome": "MARCA X"
      }
      }
    
  • Failure Responses

    Status Code Content-Type Response Body
    400 application/json {"error": "Bad Request", "message": "Validation error", "status": 400, "details": ["O nome do modelo não pode ser nulo.", "O nome do modelo não pode ser vazio.", "O nome do condutor deve ter no máximo 40 caracteres.", "O objeto marca não foi informado."]}
    500 application/json {"error": "Internal Server Error", "message": "An unexpected error occurred.", "status": 500}
    503 application/json {"error": "Service Unavailable", "message": "The service is currently unavailable.", "status": 503}
Clone this wiki locally