POST /types

Create a new energy generator type (renewable/non-renewable)

application/json

Body Required

Type data

  • description string Required

    Maximum length is 80.

  • isRenewable boolean
  • name string Required

    Maximum length is 20.

Responses

  • 201 application/json

    Created

    Hide response attributes Show response attributes object
    • createdAt string
    • description string Required

      Maximum length is 80.

    • id string
    • isRenewable boolean
    • name string Required

      Maximum length is 20.

    • updatedAt string
  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • code integer
    • error string
    • message string
  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • code integer
    • error string
    • message string
POST /types
curl \
 --request POST 'http://localhost/api/v1/types' \
 --header "Content-Type: application/json" \
 --data '{"description":"Solar photovoltaic panels","isRenewable":true,"name":"Solar"}'
Request examples
{
  "description": "Solar photovoltaic panels",
  "isRenewable": true,
  "name": "Solar"
}
Response examples (201)
{
  "createdAt": "string",
  "description": "Solar photovoltaic panels",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "isRenewable": true,
  "name": "Solar",
  "updatedAt": "string"
}
Response examples (400)
{
  "code": 400,
  "error": "Invalid input",
  "message": "The provided data is invalid"
}
Response examples (500)
{
  "code": 400,
  "error": "Invalid input",
  "message": "The provided data is invalid"
}