Skip to content

Request Architecture

krishna kumar edited this page Oct 14, 2017 · 10 revisions

All the requests are POST-requests where all the parameters are sent in the body (x-www-form-urlencoded). Everyone can use the route and poi urls, but for the stats you'll need to be logged in as a user in the android app.

/route/generate/

Description

When using this request the server generates a route starting and ending in a certain coordinate and gives within the response the generated route.

Body Structure

lat: coordinate latitude

lon: coordinate longitude

distance: The route distance

tags: the requested POI's

type: the response type. See the geojson.respond_path function for more details

**** Special Note ----- In order to have the poi points in the route,one must have to use type = directions or coordinates

/route/return/

Description

This generates a route leading the user back to his starting point. This is mainly used if the user wants a longer or shorter route or if the user went off-route and a new route is needed.

Body Structure

visited_path: the route that the user used to run.

lon, lat: position of the user.

distance: The preferred distance to the starting point.

/stats/check/

Description

Check out the current statistics in the database of the specified user. Used mainly for synchronization between the app and the database. The response of this request are all the runing statistics and edit time.

Body Structure

android_token: The token generated on the app by firebase (for IOS, firebase can also be used). This is used on our server to verify and identify users.

/stats/update/

Description

Updates or inserts the statistics of the user corresponding to the received token.

Body Structure

android_token

avg_heartrate: Average heartrate of the user

avg_distance: Average distance that the user runs

tot_distance: Total distance ran

tot_duration: Total time spent running

avg_duration: Average duration of a run

runs: Amount of runs the user made

edit_time: Epoch time for when the stats were last edited in milliseconds

/poi/coords/

Body Structure

tags: a list of poi tags eg. &tags=water&tags=park

Description

Gives a response with all the points of interest according to a list of tags, it returns each point in the following format:

{
    "lat": 54.6,
    "lon": 3.6,
    "name": "some point",
    "description": "this is some point."
}

/poi/types/

Description

Gives all the possible POI-tags the server accepts and returns it as an array.