python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
export FLASK_APP=diary_api.py
export FLASK_ENV=development
export FLASK_RUN_PORT=5000
flask db upgrade
flask runPOST v1/users- Create a new userGET v1/users?email_address=<string:email_address>- Retrieve a user by email addressGET v1/users/<uuid:user_id>- Retrieve a specific userPUT v1/users/<uuid:user_id>/profile- Update a specific users profilePUT v1/users/<uuid:user_id>/password- Update a specific users passwordDELETE v1/users/<uuid:user_id>- Delete a specific user
POST v1/login- Authenticate user credentials
POST v1/children- Create a new childGET v1/children?user_id=<uuid:user_id>Retrieve a list of children for a userGET v1/children/<uuid:child_id>- Retrieve a specific childPUT v1/children/<uuid:child_id>- Update a specific childDELETE v1/children/<uuid:child_id>- Delete a specific child
POST v1/children/<uuid:child_id>/events- Create a new event for a childGET v1/children/<uuid:child_id>/events- Retrieve a list of events for a childGET v1/children/<uuid:child_id>/events/<uuid:event_id>- Retrieve a specific event for a childPUT v1/children/<uuid:child_id>/events/<uuid:event_id>- Update a specific event for a childDELETE v1/children/<uuid:child_id>/events/<uuid:event_id>- Delete a specific event for a child
More details are in the OpenAPI Specification
These events occurred at a single point in time. They have a single occurred_at attribute set to the a valid ISO 8601 formatted timestamp.
- Change
These events occurred over a period of time. The started_at attribute is always set. The ended_at attribute may be null if the event is currently ongoing, or a valid ISO 8601 formatted timestamp if the event has ended.
- Sleep
- Feed
Example requests to POST v1/children/<uuid:id>/events endpoint:
Request body:
{
"user_id": "eac11681-532e-4ec1-8d33-18337485e083",
"type": "sleep",
"started_at": "2018-07-21T21:21:59.123456",
"ended_at": null,
"notes": "Very tired!"
}Request body:
{
"user_id": "eac11681-532e-4ec1-8d33-18337485e083",
"type": "feed",
"feed_type": "breast",
"started_at": "2018-07-21T21:21:59.123456",
"ended_at": null,
"side": "left",
"notes": "Very hungry!"
}Request body:
{
"user_id": "eac11681-532e-4ec1-8d33-18337485e083",
"type": "feed",
"feed_type": "bottle",
"started_at": "2018-07-21T21:21:59.123456",
"ended_at": null,
"amount": 12.5,
"unit": "ml",
"notes": "Very hungry!"
}Request body:
{
"user_id": "eac11681-532e-4ec1-8d33-18337485e083",
"type": "feed",
"feed_type": "formula",
"started_at": "2018-07-21T21:21:59.123456",
"ended_at": null,
"amount": 12.5,
"unit": "ml",
"notes": "Very hungry!"
}Request body:
{
"user_id": "eac11681-532e-4ec1-8d33-18337485e083",
"type": "change",
"change_type": "wet",
"occurred_at": "2018-07-21T21:21:59.123456",
"notes": "Small wee"
}Request body:
{
"user_id": "eac11681-532e-4ec1-8d33-18337485e083",
"type": "change",
"change_type": "soiled",
"occurred_at": "2018-07-21T21:21:59.123456",
"notes": "Very smelly!"
}Request body:
{
"user_id": "eac11681-532e-4ec1-8d33-18337485e083",
"type": "change",
"change_type": "dry",
"occurred_at": "2018-07-21T21:21:59.123456",
"notes": "Clean"
}