Group B
GitHub repo
Date updated
URL
Person related endpoints
Method | URL | Request Body (JSON) | Response (JSON) | Error (e) |
GET | /api/persons (get all persons) | [person, person, ...](1) | ||
GET | /api/persons/{id} (get person) | id: a person id | person (1) | (e1) |
POST | /api/persons (create a person) | person (1) | person (1) | (e2) |
PUT | /api/persons/{id} (edit person) | id: a person id | person (1) | (e1)(e2) |
DELETE | /api/persons/{id} (delete person) | id: a person id | person (1) | (e1) |
GET | /api/persons/phone/{phoneNumber}
(get person with a phone number) | phoneNumber: a person phone.number | person (1) | (e1) |
GET | /api/persons/{id}/addhobby/{id2} (add hobby to a person) | id: person id id2: hobby id | person (1) | (e1) |
GET | /api/persons/{id}/removehobby/{id2} (remove hobby from a person) | id: person id id2: hobby id | person (1) | (e1) |
GET | /api/persons/city/{zipCode} (get all persons given a zipcode) | zipCode: a valid danish zipcode | [person, person, ...](1) | (e1) |
GET | /api/persons/hobby/{id} (get all persons given a hobby) | id: hobby id | [person, person, ...](1) | (e1) |
GET | /api/persons/amount/hobby/{id} (get amount of persons with a hobby) | id: hobby id | (2) | (e1) |
Hobby related endpoints
Method | URL | Request Body (JSON) | Response (JSON) | Error (e) |
GET | /api/hobbies (get all hobbies) | [hobby, hobby, ...](3) | ||
GET | /api/hobbies/{id} (get hobby by id) | id: a hobby id | hobby (3) | (e1) |
GET | /api/hobbies/name/{hobbyName} (get hobby by name) | hobbyName: a hobby name | hobby (3) | (e1) |
City related endpoints
Method | URL | Request Body (JSON) | Response (JSON) | Error (e) |
GET | /api/cities (get all cities) | [city, city, ...](4) | ||
GET | /api/cities/{id} (get city by id) | id: a city id | city (4) | (e1) |
GET | /api/cities/zip/{zipcode} (get city by zipcode) | zipcode: a valid danish city zip code | city (4) | (e1) |
GET | /api/cities/name/{cityName} (get city by name) | name: a valid danish city name | city (4) | (e1) |
(1) Person format (don’t provide ID, for POST)
{
"email": String, (has to be a valid email format)
"firstName": String, (at least 2 characters)
"lastName": String, (at least 2 characters)
"phone": {
"number": String, (has to be 8 digits)
"description": String, (e.g. telecommunications company - can be null)
"isPrivate": boolean
},
"address": {
"street": String,
"additionalInfo": String,
"isPrivate": boolean,
"cityinfo": {
"zipCode": int (has to be a valid danish zipcode)
}
}
}
(2) Example result
{
"hobby": "Brasiliansk jiu-jitsu",
"personcount": "1"
}
(3) Hobby format
{
"id": 1,
"wikiLink": "https://en.wikipedia.org/wiki/3D_printing",
"name": "3D-udskrivning",
"category": "Generel",
"type": "Indendørs",
"people": []
}
(3) City format
{
"id": 1,
"zipCode": 555,
"cityName": "Scanning",
"addresses": []
}
(e) All errors are reported using this format (with the HTTP-status code matching the number)
{ status : statusCode, "msg": "Explains the problem" }