Home - ocariot/api-gateway GitHub Wiki
OCARIoT API Gateway
This is the single-entry point for interaction between the OCARIoT clients (Data Acquisition App, OCARIoT App, OCARIoT dashboard and Embedded Gateway) and microservices. Acting as a reverse proxy, the API Gateway integrates all the microservice APIs in a single RESTful API, abstracting the complexities of the OCARIoT microservice platform and simplifying the communication for OCARIoT clients. It also implements a set of transversal features, e.g., authentication and authorization policies, load balancing, rate limiter, etc.
Getting started
This documentation describes all possible responses for all routes mapped in this component, with different response types and errors separated by feature. In addition to describing who is allowed to access each route.
Visit auth to understand a little about the authentication mechanism and how to use it. After that, just explore the other available routes.
Route permissions
The scopes of each user are detailed here, where for example a Family user can read data from a child (children:read, which is the scope of the GET child by ID route), but the child must be associated with it to make this possible.
Most of the mapped routes have some similar permission details that were implemented through authorization policies here in the API Gateway, these details are explained (and highlighted in bold) in 'description' section of each route.
Query string support
Some GET ALL routes support the use of query strings, and on each of these routes there are specific usage examples.
For more details go to the Query Strings section.
Microservice endpoints
Account
auth
- POST /v1/auth
users
- DELETE /v1/users/{user_id}
- PUT /v1/users/{user_id}/password
- POST /v1/users/{user_id}/reset-password
- POST /v1/users/types/{user_type}/scopes
institutions
- POST /v1/institutions
- GET /v1/institutions
- GET /v1/institutions/{institution_id}
- PATCH /v1/institutions/{institution_id}
- DELETE /v1/institutions/{institution_id}
children
- POST /v1/children
- GET /v1/children
- GET /v1/children/{child_id}
- PATCH /v1/children/{child_id}
educators
- POST /v1/educators
- GET /v1/educators
- GET /v1/educators/{educator_id}
- PATCH /v1/educators/{educator_id}
educators.children.groups
- POST /v1/educators/{educator_id}/children/groups
- GET /v1/educators/{educator_id}/children/groups
- GET /v1/educators/{educator_id}/children/groups/{group_id}
- PATCH /v1/educators/{educator_id}/children/groups/{group_id}
- DELETE /v1/educators/{educator_id}/children/groups/{group_id}
families
- POST /v1/families
- GET /v1/families
- GET /v1/families/{family_id}
- PATCH /v1/families/{family_id}
families.children
- GET /v1/families/{family_id}/children
- POST /v1/families/{family_id}/children/{child_id}
- DELETE /v1/families/{family_id}/children/{child_id}
healthprofessionals
- POST /v1/healthprofessionals
- GET /v1/healthprofessionals
- GET /v1/healthprofessionals/{healthprofessional_id}
- PATCH /v1/healthprofessionals/{healthprofessional_id}
healthprofessionals.children.groups
- POST /v1/healthprofessionals/{healthprofessional_id}/children/groups
- GET /v1/healthprofessionals/{healthprofessional_id}/children/groups
- GET /v1/healthprofessionals/{healthprofessional_id}/children/groups/{group_id}
- PATCH /v1/healthprofessionals/{healthprofessional_id}/children/groups/{group_id}
- DELETE /v1/healthprofessionals/{healthprofessional_id}/children/groups/{group_id}
applications
- POST /v1/applications
- GET /v1/applications
- GET /v1/applications/{application_id}
- PATCH /v1/applications/{application_id}
IoT Tracking
children.physicalactivities
- POST /v1/children/{child_id}/physicalactivities
- GET /v1/children/{child_id}/physicalactivities
- GET /v1/children/{child_id}/physicalactivities/{physicalactivity_id}
- DELETE /v1/children/{child_id}/physicalactivities/{physicalactivity_id}
children.logs
- POST /v1/children/{child_id}/logs/{resource}
- GET /v1/children/{child_id}/logs/date/{date_start}/{date_end}
- GET /v1/children/{child_id}/logs/{resource}/date/{date_start}/{date_end}
children.sleep
- POST /v1/children/{child_id}/sleep
- GET /v1/children/{child_id}/sleep
- GET /v1/children/{child_id}/sleep/{sleep_id}
- DELETE /v1/children/{child_id}/sleep/{sleep_id}
children.weights
- POST /v1/children/{child_id}/weights
- GET /v1/children/{child_id}/weights
- GET /v1/children/{child_id}/weights/{weight_id}
- DELETE /v1/children/{child_id}/weights/{weight_id}
children.bodyfats
- POST /v1/children/{child_id}/bodyfats
- GET /v1/children/{child_id}/bodyfats
- GET /v1/children/{child_id}/bodyfats/{bodyfat_id}
- DELETE /v1/children/{child_id}/bodyfats/{bodyfat_id}
institutions.environments
- POST /v1/institutions/{institution_id}/environments
- GET /v1/institutions/{institution_id}/environments
- DELETE /v1/institutions/{institution_id}/environments
- DELETE /v1/institutions/{institution_id}/environments/{environment_id}
Data Sync Agent
fitbit
- GET /v1/fitbit
fitbit.subscriber
users.fitbit.auth
- POST /v1/users/{user_id}/fitbit/auth
- GET /v1/users/{user_id}/fitbit/auth
- POST /v1/users/{user_id}/fitbit/auth/revoke
users.fitbit.sync
Questionnaires
Q1Sociodemographic
- GET /v1/q1sociodemographics/count
- PUT /v1/q1sociodemographics/{id}
- PATCH /v1/q1sociodemographics/{id}
- GET /v1/q1sociodemographics/{id}
- DELETE /v1/q1sociodemographics/{id}
- POST /v1/q1sociodemographics
- PATCH /v1/q1sociodemographics
- GET /v1/q1sociodemographics
Q21ChildsHealthConditions
- GET /v1/q21childshealthconditions/count
- PUT /v1/q21childshealthconditions/{id}
- PATCH /v1/q21childshealthconditions/{id}
- GET /v1/q21childshealthconditions/{id}
- DELETE /v1/q21childshealthconditions/{id}
- POST /v1/q21childshealthconditions
- PATCH /v1/q21childshealthconditions
- GET /v1/q21childshealthconditions
Q22ParentsHealthConditions
- GET /v1/q22parentshealthconditions/count
- PUT /v1/q22parentshealthconditions/{id}
- PATCH /v1/q22parentshealthconditions/{id}
- GET /v1/q22parentshealthconditions/{id}
- DELETE /v1/q22parentshealthconditions/{id}
- POST /v1/q22parentshealthconditions
- PATCH v1/q22parentshealthconditions
- GET /v1/q22parentshealthconditions
Q23IPAQ
- GET /v1/q23ipaq/count
- PUT /v1/q23ipaq/{id}
- PATCH /v1/q23ipaq/{id}
- GET /v1/q23ipaq/{id}
- DELETE /v1/q23ipaq/{id}
- POST /v1/q23ipaq
- PATCH /v1/q23ipaq
- GET /v1/q23ipaq
Q3PhysicalAnthropometricMeasures
- GET /v1/q3physicalandanthropometricmeasures/count
- PUT /v1/q3physicalandanthropometricmeasures/{id}
- PATCH /v1/q3physicalandanthropometricmeasures/{id}
- GET /v1/q3physicalandanthropometricmeasures/{id}
- DELETE /v1/q3physicalandanthropometricmeasures/{id}
- POST /v1/q3physicalandanthropometricmeasures
- PATCH /v1/q3physicalandanthropometricmeasures
- GET /v1/q3physicalandanthropometricmeasures
Q401FoodFrequency
- GET /v1/q401ffq/count
- PUT /v1/q401ffq/{id}
- PATCH /v1/q401ffq/{id}
- GET /v1/q401ffq/{id}
- DELETE /v1/q401ffq/{id}
- POST /v1/q401ffq
- PATCH /v1/q401ffq
- GET /v1/q401ffq
Q402FoodHabitsandFeedingBehaviours
- GET /v1/q402foodhabitsandfeedingbehaviors/count
- PUT /v1/q402foodhabitsandfeedingbehaviors/{id}
- PATCH /v1/q402foodhabitsandfeedingbehaviors/{id}
- GET /v1/q402foodhabitsandfeedingbehaviors/{id}
- DELETE /v1/q402foodhabitsandfeedingbehaviors/{id}
- POST /v1/q402foodhabitsandfeedingbehaviors
- PATCH /v1/q402foodhabitsandfeedingbehaviors
- GET /v1/q402foodhabitsandfeedingbehaviors
Q501PhysicalActivityForChildren
- GET /v1/q501physicalactivityforchildren/count
- PUT /v1/q501physicalactivityforchildren/{id}
- PATCH /v1/q501physicalactivityforchildren/{id}
- GET /v1/q501physicalactivityforchildren/{id}
- DELETE /v1/q501physicalactivityforchildren/{id}
- POST /v1/q501physicalactivityforchildren
- PATCH /v1/q501physicalactivityforchildren
- GET /v1/q501physicalactivityforchildren
Q502PhysicalActivityandSedentaryHabits
- GET /v1/q502physicalactivityandsedentaryhabits/count
- PUT /v1/q502physicalactivityandsedentaryhabits/{id}
- PATCH /v1/q502physicalactivityandsedentaryhabits/{id}
- GET /v1/q502physicalactivityandsedentaryhabits/{id}
- DELETE /v1/q502physicalactivityandsedentaryhabits/{id}
- POST /v1/q502physicalactivityandsedentaryhabits
- PATCH /v1/q502physicalactivityandsedentaryhabits
- GET /v1/q502physicalactivityandsedentaryhabits
Q503SleepingHabits
- GET /v1/q503sleepinghabits/count
- PUT /v1/q503sleepinghabits/{id}
- PATCH /v1/q503sleepinghabits/{id}
- GET /v1/q503sleepinghabits/{id}
- DELETE /v1/q503sleepinghabits/{id}
- POST /v1/q503sleepinghabits
- PATCH /v1/q503sleepinghabits
- GET /v1/q503sleepinghabits
Q601ChildEatingBehaviour
- GET /v1/q601childeatingbehaviour/count
- PUT /v1/q601childeatingbehaviour/{id}
- PATCH /v1/q601childeatingbehaviour/{id}
- GET /v1/q601childeatingbehaviour/{id}
- DELETE /v1/q601childeatingbehaviour/{id}
- POST /v1/q601childeatingbehaviour
- PATCH /v1/q601childeatingbehaviour
- GET /v1/q601childeatingbehaviour
Q602Autoperception
- GET /v1/q602autoperception/count
- PUT /v1/q602autoperception/{id}
- PATCH /v1/q602autoperception/{id}
- GET /v1/q602autoperception/{id}
- DELETE /v1/q602autoperception/{id}
- POST /v1/q602autoperception
- PATCH /v1/q602autoperception
- GET /v1/q602autoperception
QFoodtracking
- GET /v1/qfoodtrackings/count
- PUT /v1/qfoodtrackings/{id}
- PATCH /v1/qfoodtrackings/{id}
- GET /v1/qfoodtrackings/{id}
- DELETE /v1/qfoodtrackings/{id}
- POST /v1/qfoodtrackings
- PATCH /v1/qfoodtrackings
- GET /v1/qfoodtrackings
Gamification
AgentReport
- GET /v1/agentreports/count
- PUT /v1/agentreports/{id}
- PATCH /v1/agentreports/{id}
- GET /v1/agentreports/{id}
- DELETE /v1/agentreports/{id}
- POST /v1/agentreports
- PATCH /v1/agentreports
- GET /v1/agentreports
Badge
- GET /v1/badges/count
- PUT /v1/badges/{id}
- PATCH /v1/badges/{id}
- GET /v1/badges/{id}
- DELETE /v1/badges/{id}
- POST /v1/badges
- PATCH /v1/badges
- GET /v1/badges
CustomizationItem
- GET /v1/customizationitems/count
- PUT /v1/customizationitems/{id}
- PATCH /v1/customizationitems/{id}
- GET /v1/customizationitems/{id}
- DELETE /v1/customizationitems/{id}
- POST /v1/customizationitems
- PATCH /v1/customizationitems
- GET /v1/customizationitems
GamificationProfile
- GET /v1/gamificationprofiles/count
- PUT /v1/gamificationprofiles/{id}
- PATCH /v1/gamificationprofiles/{id}
- GET /v1/gamificationprofiles/{id}
- DELETE /v1/gamificationprofiles/{id}
- POST /v1/gamificationprofiles
- PATCH /v1/gamificationprofiles
- GET /v1/gamificationprofiles
Mission
- GET /v1/missions/count
- PUT /v1/missions/{id}
- PATCH /v1/missions/{id}
- GET /v1/missions/{id}
- DELETE /v1/missions/{id}
- POST /v1/missions
- PATCH /v1/missions
- GET /v1/missions
Question
- GET /v1/questions/count
- PUT /v1/questions/{id}
- PATCH /v1/questions/{id}
- GET /v1/questions/{id}
- DELETE /v1/questions/{id}
- POST /v1/questions
- PATCH /v1/questions
- GET /v1/questions
Food
FoodHabits
- GET /v1/foodqs/count
- PUT /v1/foodqs/{id}
- PATCH /v1/foodqs/{id}
- GET /v1/foodqs/{id}
- DELETE /v1/foodqs/{id}
- POST /v1/foodqs
- PATCH /v1/foodqs
- GET /v1/foodqs
Missions
Mission selection
- GET /v1/observations/observations-severities/{childId}
- GET /v1/observations/analyze-results/{childId}
- POST /v1/observations/update-progress/{missionId}
- POST /v1/observations/activate-mission/{missionId}
- POST /v1/observations/complete-mission/{missionId}
- GET /v1/observations/get-active-missions/{childId}
- GET /v1/observations/get-completed-missions/{childId}
- GET /v1/observations/get-all-missions/{childId}
- GET /v1/observations/get-stratification/{childId}
- POST /v1/observations/answer-question/{childId}
DSS
- GET /v1/observations/get-questionnaires
- GET /v1/observations/get-week-questionnaires/{childId}
Robot
- GET /v1/robot-result/food-recognition/{childId}
- POST /v1/robot-result/food-recognition
- POST /v1/robot-result
- GET /v1/robot-result/mission/{childId}
Educator Missions
- POST /v1/educator-missions
- GET /v1/educator-missions
- GET /v1/educator-missions/{missionId}
- PUT /v1/educator-missions/{missionId}
- DELETE /v1/educator-missions/{missionId}
- POST /v1/educator-missions/activate
- POST /v1/educator-missions/validate
- GET /v1/educator-missions/active/{childId}
- GET /v1/educator-missions/completed/{childId}
- POST /v1/educator-missions/assign
- GET /v1/educator-missions/assign/{childId}
Notification
notifications.user
- POST /v1/notifications/user/{userId}
notifications.pendingnotification
- GET /v1/notifications/pendingnotification/{userId}
notifications.deletetoken
- DELETE /v1/notifications/deletetoken/{userId}