Adicionar nova categoria

POST /categories

Cria uma nova categoria no sistema.

application/json

Body Required

Responses

  • 201 application/json

    Categoria criada com sucesso

    Hide response attributes Show response attributes object
    • message string
    • category object

      Additional properties are allowed.

      Hide category attributes Show category attributes object
  • 409 application/json

    Conflito, a categoria já existe

    Hide response attributes Show response attributes object
    • message string
    • category object

      Additional properties are allowed.

      Hide category attributes Show category attributes object
POST /categories
curl \
 --request POST 'http://localhost:8000/categories' \
 --header "Content-Type: application/json" \
 --data '{"name":"Vegetables"}'
Request examples
{
  "name": "Vegetables"
}
Response examples (201)
{
  "message": "string",
  "category": {
    "id": 42,
    "name": "string"
  }
}
Response examples (409)
{
  "message": "string",
  "category": {
    "id": 42,
    "name": "string"
  }
}