Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
iti0213-2019s
Course Materials
Commits
99fb528b
Commit
99fb528b
authored
Apr 16, 2020
by
Andres Käver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hw2 backend
parent
9b1aa7a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
11 deletions
+47
-11
homeworks/HW2-backend.md
homeworks/HW2-backend.md
+47
-11
No files found.
homeworks/HW2-backend.md
View file @
99fb528b
# HW2 - Backend
All projects:
All projects
for SportMap
:
https://git.akaver.com/com-akaver-sportmap
Full source code for the backend i
n
visible here:
Full source code for the backend i
s
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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment