API Plan Documentation - bounswe/2021SpringGroup6 GitHub Wiki

API Plan Documentation

  • This page is to keep the API design decisions taken on the back-end meetings on the Wiki page.
  • This is not the official documentation, therefore API endpoints here may not be implemented yet.
  • parameters with "*" are optional.
  • Paths of implemented endpoints are bold.
  • All messages are given with the "message" keyword in the json response.

User Related Endpoints

path type functionality parameters example example response
users/ POST register a new user email : string
password : string
identifier : string
name* : string
familyName* : string
birthDate* : string
gender* : string
sports* : list of dictionaries
email : "[email protected]"
password : "12fgh45y2"
identifier : "elif"
name : "elif"
familyName : "ball"
birthDate : "2001-03-30"
gender : "female"
sports :
[{"sport":"soccer", "skill_level":2}]
status 201
users/login/ POST login an existing user password : string
identifier : string
password: "1245g452"
identifier: "esb"
status 200
{"token": "f9962f3df17868bd50654186f76c2dec3ef3976",
"user_id": 4}
users/recover/ POST recover an user who forgot
the password
email : string email : "[email protected]" status 200
{"message": "If email provided is correct, a reset password is sent, please check spam."}
users/<user_id>/ GET get user information status 200
{
"user_id": 1,
"email": "[email protected]",
"identifier": "test",
"name": "",
"familyName": "",
"birthDate": null,
"gender": null,
"@context": "https://schema.org/Person",
"@id": 1,
"@type": "Person",
"knowsAbout":
[
{
"@type": "PropertyValue",
"name": "soccer",
"value": 2
}
]
}
users/<user_id>/ DELETE delete a user password : string password : "145y42"
users/logout/ POST log out a user status 200
{"message": "Successfully logged out."}
users/user_id/ PUT change profile information email* : string
password* : string
identifier* : string
name* : string
familyName* : string
location* : string
birthDate* : string
gender* : string
sports* : list of dictionaries
identifier : "elif"


name : "elif"

sports :

[{"sport":3, "skill_level":2}]
users/<user_id>/following POST follow a user user_id : int user_id : 5
users/<user_id>/following DELETE unfollow a user user_id : int user_id : 5
users/<user_id>/following GET get users followed by user
with user_id
status 200
{ "@context": "https://www.w3.org/ns/activitystreams",
"summary": "esb's following activities.",
"type": "Collection",
"total_items": 1,
"items": [
{
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "esb followed sdsdsdsd",
"type": "Follow",
"actor": {
"type": "https://schema.org/Person",
"@id": 4,
"identifier": "esb"
},
"object": {
"type": "https://schema.org/Person",
"@id": 1,
"identifier": "sdsdsdsd"
} } ] }
users/<user_id>/followers GET get users who follow user
with user_id
status 200
{ "@context": "https://www.w3.org/ns/activitystreams",
"summary": "sdsdsdsd's being followed activities.",
"type": "Collection",
"total_items": 1,
"items": [
{
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "esb followed sdsdsdsd",
"type": "Follow",
"actor": {
"type": "https://schema.org/Person",
"@id": 4,
"identifier": "esb"
},
"object": {
"type": "https://schema.org/Person",
"@id": 1,
"identifier": "sdsdsdsd"
}
users/<user_id>/visible_attributes PUT set visible attibutes attribute_id : int attribute_id : 5
users/<user_id>/blocked POST block a user user_id : int user_id : 5
users/<user_id>/blocked DELETE unblock a user user_id : int user_id : 5
users/<user_id>/blocked GET get users blocked by user
with user_id

Sport Related Endpoints

path type functionality parameters example example response
sports/ GET get supported sport names in our system status 200
{
"sport_names":
[
"soccer",
"motorsport",
"fighting",
"baseball",
"basketball"
]
}
⚠️ **GitHub.com Fallback** ⚠️