Commit 99fb528b authored by Andres Käver's avatar Andres Käver

hw2 backend

parent 9b1aa7a4
# HW2 - Backend
All projects:
All projects for SportMap:
https://git.akaver.com/com-akaver-sportmap
Full source code for the backend in visible here:
Full source code for the backend is visible here:
https://git.akaver.com/com-akaver-sportmap/sportmap-aspnet
ERD schema is simple:
* GpsSession - training sessions
* GpsLocation - locations for session (WP, CP, regular)
* GpsLocationType - LocationTypes for location
Base url for RESTful api: https://sportmap.akaver.com/api/
Create account, log in - get and save jwt.
Set the header on every request:
***Content-Type application/json***
Create account, log in - get and save the jwt.
POST https://sportmap.akaver.com/api/account/register
and
Payload in body as json:
~~~~json
{
"email": "akaver1@akaver.com",
"password": "Kala.maja2020",
"lastName": "Andres",
"firstName": "Käver"
}
~~~~
or
POST https://sportmap.akaver.com/api/account/login
Payload in body as json:
~~~~json
{
"email": "akaver1@akaver.com",
"password": "Kala.maja2020",
}
~~~~
Response for successful register and login:
~~~~json
{
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjU2MGIxMWM5LWVlYTYtNDNhMy1jYTViLTA4ZDdlMTc3MGNhOSIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJha2F2ZXJAYWthdmVyLmNvbSIsIkFzcE5ldC5JZGVudGl0eS5TZWN1cml0eVN0YW1wIjoiMlozVzZEMkozT1RTS0dNQ0xMU09IM1ZZS1pUQkxYRk4iLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3JvbGUiOlsidXNlciIsImFkbWluIl0sImV4cCI6MTU4OTYxNDczNSwiaXNzIjoiY29tLmFrYXZlci5zcG9ydG1hcCIsImF1ZCI6ImNvbS5ha2F2ZXIuc3BvcnRtYXAifQ.B0YNH-0rUgethh3TgdQXV7s3PcM87OgQBPJ2VTnBnw4d64dG4z-V4QztKbwYyPUNRtdzc7Gc89Bdsi2egYjdgA",
"status": "User akaver@akaver.com logged in."
}
~~~~
On every request include token and content-type in request header:
***Authorization Bearer eyJhbGciOiJIU...***
***Content-Type application/json***
There are 3 RESTful endpoints defined for your usage:
https://sportmap.akaver.com/api/GpsSessions
https://sportmap.akaver.com/api/GpsLocations
https://sportmap.akaver.com/api/GpsLocationTypes
There are 3 RESTful endpoints defined for your app:
Include jwt in every request header!
Authorization: Bearer lijvfvkdnvldnvsdcsv237eskdfn
* https://sportmap.akaver.com/api/GpsSessions
* https://sportmap.akaver.com/api/GpsLocations
* https://sportmap.akaver.com/api/GpsLocationTypes
Start a new session:
POST https://sportmap.akaver.com/api/GpsSessions
......@@ -56,8 +91,9 @@ Response will be:
~~~~
Save the session id!
Duration, speed etc will be calculated by the backend as data arrives.
Get the list of location types (these are predefined in db, id's and types are fixed)
Get the list of location types (these are predefined in db, id's and types are fixed)
GET https://sportmap.akaver.com/api/GpsLocationTypes
Response will be:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment