Base URL: /v1, Version: 1.0.0
Track symptoms with the HAppi API
| Operation | Description |
|---|---|
| GET /symptoms | Retrieve symptoms |
| GET /symptoms/occurrences | Get a list of symptoms with the linked occurrences for the current user. |
| POST /occurrences | Add a symptom occurrence |
| GET /stats/count | Count how many occurrences of some symptoms occurred between a start date and an end date, based on a given unit, for a given set of symptoms. |
| Operation | Description |
|---|---|
| GET /symptoms/occurrences | Get a list of symptoms with the linked occurrences for the current user. |
| GET /occurrences | Get the list of symptom occurences |
| POST /occurrences | Add a symptom occurrence |
| DELETE /occurrences | Remove the occurrence associated to the id |
| GET /stats/count | Count how many occurrences of some symptoms occurred between a start date and an end date, based on a given unit, for a given set of symptoms. |
| POST /reports | Create a new shared occurrences report. |
| Operation | Description |
|---|---|
| POST /auth | Create account |
| POST /auth/sign_in | Login |
| DELETE /auth/sign_out | Log out |
| GET /auth/validate_token | Check if the given token is still valid. |
| Operation | Description |
|---|---|
| GET /stats/count | Count how many occurrences of some symptoms occurred between a start date and an end date, based on a given unit, for a given set of symptoms. |
| Operation | Description |
|---|---|
| GET /symptoms_user | Return a list of symptoms associated to the logged in user |
| POST /symptoms_user | Add the given symptoms_user to the database |
| DELETE /symptoms_user | Remove the symptom_id associated to the user |
| Operation | Description |
|---|---|
| POST /reports | Create a new shared occurrences report. |
| GET /reports | Retrieve a report based on a token and an email address. |
| Operation | Description |
|---|---|
| POST /reports | Create a new shared occurrences report. |
| GET /reports | Retrieve a report based on a token and an email address. |
Create a new account for the given email with the given password.
application/json
The new account information
Uses default content-types: application/json
Account created. The headers that are returned must be included in every following request in order to valid the authentication.
| Access-Token | This serves as the user's password for each request. A hashed version of this value is stored in the database for later comparison. |
string |
| Client | This enables the use of multiple simultaneous sessions on different clients. (For example, a user may want to be authenticated on both their phone and their laptop at the same time.) |
string |
| Uid | A unique value that is used to identify the user. This is necessary because searching the DB for users by their access token will make the API susceptible to timing attacks. |
string |
| Token-Type | Always 'Bearer' |
string , x ∈ { Bearer } |
| Expiry | The date at which the current session will expire. This can be used by clients to invalidate expired tokens without the need for an API request. |
string |
An error occurred and the error is detailled in the errors key of the response
Login an account by checking the {email, password} pair. The headers that are returned must be included in every following request in order to valid the authentication.
application/json
The new account information
Uses default content-types: application/json
Account created.
| Access-Token | This serves as the user's password for each request. A hashed version of this value is stored in the database for later comparison. |
string |
| Client | This enables the use of multiple simultaneous sessions on different clients. (For example, a user may want to be authenticated on both their phone and their laptop at the same time.) |
string |
| Uid | A unique value that is used to identify the user. This is necessary because searching the DB for users by their access token will make the API susceptible to timing attacks. |
string |
| Token-Type | Always 'Bearer' |
string , x ∈ { Bearer } |
| Expiry | The date at which the current session will expire. This can be used by clients to invalidate expired tokens without the need for an API request. |
string |
Invalid login credentials.
An error occurred and the error is detailled in the errors key of the response
Log out the current account. The request must contains the authentication headers (uid, client, access-token).
| uid | Authentication information. |
header | string | |
| client | Authentication information. |
header | string | |
| access-token | Authentication information. |
header | string |
Uses default content-types: application/json
Successfully logged out.
The user was not logged in.
Returns true if the given token is valid or false.
| uid | Authentication information. |
header | string | |
| client | Authentication information. |
header | string | |
| access-token | Authentication information. |
header | string |
Uses default content-types: application/json
Token is valid.
Token is not valid.
| occurrence_id | Id of the occurrence to delete |
query | integer |
Uses default content-types: application/json
The occurrence linked to the id is correctly deleted
The user has not the authorization
The given occurrence_id is not valid or does not exist for the useret
Get the list of symptom occurences from the database
Uses default content-types: application/json
List of symptom occurences
Not allowed to get list of symptom occurences
Add the received symptom occurrence to the database.
application/json
The occurrence to add.
| uid | Authentication information. |
header | string | |
| client | Authentication information. |
header | string | |
| access-token | Authentication information. |
header | string |
Uses default content-types: application/json
Occurrence correctly added.
The given object is not a valid occurrence.
Return the report associated to the given token. The report was sent to the given email address. It contains all the symptoms and occurrences that the patient agreed to share with its doctor.
| token | A token identifying the report to access. |
query | string | |
The email address to which the report was sent. |
query | string |
Uses default content-types: application/json
The report was found, the token and email were valid. The expiration_date is not passed yet.
Create a new shared occurrences report containing all the occurrences of the user between the given start_date and end_date. It is associated to the email address of a doctor and have an expiration date. The value of expiration_date is optionnal and will be set to 2 weeks from now by default.
Uses default content-types: application/json
The report parameters
Uses default content-types: application/json
The shared occurrences report has been created
Compute the number of occurrences that occurred for all the symptoms of the current user. The default unit to count the occurrences is per 'days' but it can also be counted per 'hours', 'months' and 'years'. The list of symptoms can be filtered via the 'symptoms' parameter that receives a list of 'symptom_id'. The occurrences can be filtered by using the 'start' and 'end' date parameters.
| start | Start date of the occurrences to count. Any occurrences that were created before this date will be ignored. |
query | string (date-time) | |
| end | End date of the occurrences to count. Any occurrences that were created after this date will be ignored. |
query | string (date-time) | |
| unit | The 'unit' parameter must take one of the following value: 'hours', 'days', 'months', 'years'. The default value is per 'days'. This parameter determine how to count occurrences. |
query | string , x ∈ { hours , days (default) , months , years } | |
| symptoms | An array of symptoms' id to include in the result. Only those symptoms will be included in the result. If this parameter is not present, all the symptoms will be included. |
query | integer[] |
Uses default content-types: application/json
An array of SymptomsCounts
Invalid parameter, the end date is before the start date.
The Symptom endpoint returns information about the symptom . The response includes the symptoms filtered by name and category
| name | Name of researched symptoms. |
query | string | |
| category | Category of researched symptoms. |
query | string | |
| uid | Authentication information. |
header | string | |
| client | Authentication information. |
header | string | |
| access-token | Authentication information. |
header | string |
Uses default content-types: application/json
An array of symptoms with their associated factors.
The returned list contained all the symptoms along with their occurrences that occurred.
Uses default content-types: application/json
An array of symptoms, associated with their occurrences.
| symptom_id | The symptom's id to link to the user (that is currently logged in) |
query | integer |
Uses default content-types: application/json
The symptoms_user is correctly deleted
The user has not the authorization
The given symptom_id is not valid or does not exist for the user
Uses default content-types: application/json
A list of symptoms used by the logged in user.
The user has not the authorization
Uses default content-types: application/json
The symptom's id to link to the user (that is currently logged in)
Uses default content-types: application/json
The symptoms_user is correctly added
The user has not the authorization
The given symptom_id is not valid or already exist for the user
An account from https://github.com/lynndylanhurley/devise_token_auth
Categorize the symptoms to help finding them.
Unique ID of the category.
Name of the category.
A short description of the category.
A long description of the category.
ID of the parent category.
A date associated to a number of occurrences that occurred at that date. Note that we don't know what is the unit represented by date. The occurrences can be grouped by hour, day, month, year, ...
A factor describe more accuratly an occurrence of a symptom. For example it can describe the intensity of pain or the precise location of a pain.
Unique ID of the factor
Name of the factor.
Type of the factor.
Factor with a value.
Unique ID of the instance.
Unique ID of the linked factor.
Value of the factor. Depending on the type of the factor, the value can be a number, a date, etc. This field always store the textual representation.
A GPS location as described in https://github.com/apache/cordova-plugin-geolocation#coordinates
Latitude in degrees.
Longitude in degrees.
Altitude in meters above the ellipsoid.
Accuracy of position in meters.
Accuracy of altitude in meters.
Direction if travel, specified in degress couting clockwise relative to the true north.
Current ground speed of the device, specified in meters per second.
A new account containing an email, a password and a confirmation of the password.
The email address of the new account
The password of the new account
A confirmation of the password of the new account
An occurrence of a symptom describe the moment when the symptom appeared and add some factors to describe the occurrence.
Unique ID of the occurrence.
Unique ID of the linked symptom.
Date and time when the symptom occured.
A report used to share occurrences with a doctor
The parameters to POST a report.
This value is optionnal and will be set to 2 weeks from now by default.
A symptom.
Unique ID of the symptom.
Name of the symptom.
A short description of the symptom.
A long description of the symptom.
The gender to which the symptom applies. Possible values are 'male' for male, 'female' for female and 'both' for both.
A symptom represented only by its name and id, containing an array of dates associated with a number of occurrences that occurred at that particular date.
Unique ID of the symptom.
Name of the symptom.
An array of symptoms represented only by their names and id's, each containing an array of dates associated with a number of occurrences that occurred at that particular date. The unit indicates the period between two successives dates.
A symptom with a list of all the occurrences that occurred for the current user.