Skip to content

POST children

Jefferson Medeiros edited this page Feb 7, 2020 · 7 revisions

Description

Register a new children.

Permissions:

  • Only Admin user can do this.

Scope

children:create

URL

POST https://localhost:3001/v1/children

Request body

{
  "username": "BR9999",
  "password": "mys3cr3tp4ss",
  "institution_id": "5a62be07de34500146d9c624",
  "gender": "male",
  "age": 11
}

Curl example

curl -X POST "https://localhost:3001/v1/children" -H "accept: application/json" -H "Content-Type: application/json" -d "{"username":"BR9999","password":"mys3cr3tp4ss","institution_id":"5a62be07de34500146d9c624","gender":"male","age":11}"

Response body

  • 201 Child saved sucessfully.

    {
      "id": "5db1cf6c099ed31587a74cf4",
      "username": "BR99999",
      "institution_id": "5a62be07de34500146d9c624",
      "gender": "male",
      "age": 11
    }
  • 400 Validation errors

    • Invalid JSON format

    • Invalid institution id

    • Unregistered institution

    • Missing fields

      • Example
      {
        "code": 400,
        "message": "Required fields were not provided...",
        "description": "username, password, institution, gender, age are required!"
      }
    • Empty string

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

      • Example
      {
        "code": 400,
        "message": "One or more request fields are invalid...",
        "description": "username must be a string!"
      }
    • Invalid gender

      {
        "code": 400,
        "message": "One or more request fields are invalid...",
        "description": "The names of the allowed genders are: male, female."
      }
    • Invalid age (number)

      {
        "code": 400,
        "message": "One or more request fields are invalid...",
        "description": "Age cannot be less than or equal to zero!"
      }
    • Invalid date format (age or age_calc_date)

      {
        "code": 400,
        "message": "Date: {date_parameter}, is not in valid ISO 8601 format.",
        "description": "Date must be in the format: yyyy-MM-dd"
      }
    • Invalid year (age or age_calc_date)

      {
        "code": 400,
        "message": "Date {date_parameter} has year not allowed. The year must be greater than 1678 and less than 2261."
      }
    • Invalid day (age or age_calc_date)

      {
        "code": 400,
        "message": "Date: {date_parameter}, is not in valid ISO 8601 format."
      }
    • The date received is newer than the current system date (age or age_calc_date)

      {
        "code": 400,
        "message": "Datetime: {date_parameter}, cannot be used!",
        "description": "The 'age' and 'age_calc_date' fields can only receive past or present dates."
      }
  • 409 Conflict Error

  • 500 Internal Server Error

Account users

Integration endpoints

auth

users

institutions

children

families

families.children

educators

educators.children.groups

healthprofessionals

healthprofessionals.children.groups

applications

Error patterns

400 Validation Errors

Clone this wiki locally