POST institutions - ocariot/api-gateway GitHub Wiki

Description

Register a new institution.

Permissions:

  • Only Admin user can do this.

Scope

institutions:create

URL

POST https://localhost/v1/institutions

Request body

{
  "type": "Institute of Scientific Research",
  "name": "NUTES/UEPB",
  "address": "Av. Juvêncio Arruda, S/N - Universitário, Campina Grande - PB, 58429-600",
  "latitude": "-7.2100766",
  "longitude": "-35.9175756"
}

Curl example

curl -X POST "https://localhost/v1/institutions" -H "accept: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d "{"type":"Institute of Scientific Research","name":"NUTES/UEPB","address":"Av. Juvêncio Arruda, S/N - Universitário, Campina Grande - PB, 58429-600","latitude":"-7.2100766","longitude":"-35.9175756"}"

Response body

  • 201 Institution saved sucessfully.

    {
      "id": "5db32dcabec1431c51ae15fc",
      "type": "Institute of Scientific Research",
      "name": "NUTES/UEPB",
      "address": "Av. Juvêncio Arruda, S/N - Universitário, Campina Grande - PB, 58429-600",
      "latitude": -7.2100766,
      "longitude": -35.9175756
    }
    
  • 400 Validation errors

    • Invalid JSON format

    • Missing fields

      • Example
      {
        "code": 400,
        "message": "Required fields were not provided...",
        "description": "name, type are required!"
      }
      
    • Empty string

      • Example
      {
        "code": 400,
        "message": "One or more request fields are invalid...",
        "description": "type must have at least one character!"
      }
      
    • Invalid string

      • Example
      {
        "code": 400,
        "message": "One or more request fields are invalid...",
        "description": "type must be a string!"
      }
      
  • 401 Unauthorized Error

  • 403 Permission Error

  • 409 Conflict Error

  • 429 Too Many Requests Error

  • 500 Internal Server Error