HTTP REST Data storage - Medisana/vitadock-api GitHub Wiki
| Action | Token | Resource | Return |
|
Data store POST Request |
Application/Device Token Access Token (signed with Application/Device Secret, Access Secret |
https://cloud.vitadock.com/data/[module name]?[field of module]=[value]&[other field of module]=[value]&... (*no* fields are optional except the id field. If the id field is specified then the server looks for an existing entry to update it with the given values) |
[id of the generated entry] |
|
Data store (multiple entries) POST Request |
Application/Device Token Access Token (signed with Application/Device Secret, Access Secret) |
https://cloud.vitadock.com/data/[module name]/array Headers: "Accept=application/json" (data is stored in a JSON array in the POST data, name of the array is [module name], e.g. [{"measurementDate":"03/14/12 11:39:22 PM","activityStatus":"0","bodyTemperature":37.2, "bodyTemperatureTargetMax":0.0, "bodyTemperatureTargetMin":0.0,"mood":"0"}]) (*no* fields are optional except the id field. If the id field is specified then the server looks for an existing entry to update it with the given values) |
["","", …] (the sequence of returned IDs is the same as the sequence in the POSTed JSON array that was sent to the server) |
|
Data removal POST Request |
Application/Device Token Access Token (signed with Application/Device Secret, Access Secret) |
https://cloud.vitadock.com/data/[module name]/delete?id=[id returned by a get request] | - |
|
Data removal (multiple entries) POST Request |
Application/Device Token Access Token (signed with Application/Device Secret, Access Secret) |
https://cloud.vitadock.com/data/[module name]/delete/array (data is stored in a JSON array in the POST data, name of the array is , e.g. ["[id of the entry to be deleted]","[id of the entry to be deleted]", ...] |
- |
|
Data store (random value) POST Request |
Application/Device Token Access Token (signed with Application/Device Secret, Access Secret) |
https://cloud.vitadock.com/data/[module name]/generate (generates a random entry for the specified module – for testing purposes) |
[id of the generated entry] |
Please note:
- module name is one of the following: "cardiodocks", "glucodockglucoses", "glucodockinsulins", "glucodockmeals", "targetscales" or "thermodocks"
- max: To receive all data since a certain entry multiple accesses might be needed
- Format of returning field names does not contain underscores (i.e. e.g. "activityStatus" instead of "activity_status", "createdDate" instead of "created_date" etc.)
Please note that sending data from devices with an own data storage and clock/calendar (but without a timezone!) might require special handling due to timezone (or summer/winter time) changes. To simplify the process, simply add "check_24h_date=1" as a normal header variable. This is currently a simple switch and is not included into the signature calculation.
How the flag exactly works:
- When POSTing entries via the /array interface, there is a chance that entries with identical data already exist from a previous synchronization.
- If the flag is not set:
- look for an entry with identical measurement_date in the db.
- If an entry was found, skip persisting it into the db, and add the existing id directly to the return ids and continue.
- If the flag is set:
- look for a similar entry with measurement_date +/- (0h, 1h, 2h, 3h, ..., 24h) in the db.
- a similar entry is: same number of entries (activitydock), same diastole, systole, pulse (cardiodock), same glucose (glucodock), same insulin (glucodock), same meal (glucodock), same saturation, pulse (oxymeter), same weight, body fat (targetscale), same temperature (thermodock), same activity count (tracker activity), same sleep count (tracker sleep), same steps (tracker stats)