-
Notifications
You must be signed in to change notification settings - Fork 42
Flat API Doc
- Call the user Login endpoint
- retrieve the token from the response of the login
- add
"Bearer <jwt token>"
to the Authorisation Header field - Send the Flats API request
Method: GET
Description: This method is used to get all the members in the flat
example request URL: https://localhost:44394/api/Flat/getMembers
StatusCode: 200 OK
{
"flatMembers": [
{
"id": 0,
"userName": "BeboBryan",
"firstName": "Bryan",
"lastName": "Ang",
"dateOfBirth": "1984-02-09T00:00:00",
"phoneNumber": "02243926392",
"email": "BryanAng@Gmail.com",
"medicalInformation": "N/A",
"bankAccount": "98-7654-3211234-210",
"hashedPassword": null
},
{
"id": 0,
"userName": "YinWang",
"firstName": "Yin",
"lastName": "Wang",
"dateOfBirth": "1994-12-23T00:00:00",
"phoneNumber": "0279284492",
"email": "YinWang@qq.com",
"medicalInformation": "N/A",
"bankAccount": "00-0000-0000000-000",
"hashedPassword": null
},
{
"id": 0,
"userName": "TreesAreGreen",
"firstName": "Teresa",
"lastName": "Green",
"dateOfBirth": "1996-02-12T00:00:00",
"phoneNumber": "0228937228",
"email": "GreenTrees@Yahoo.com",
"medicalInformation": "Vegan, Gluten-Free, Lactose Intolerant",
"bankAccount": "12-3456-1234567-123",
"hashedPassword": null
},
{
"id": 0,
"userName": "TonOfClay",
"firstName": "Clay",
"lastName": "Ton",
"dateOfBirth": "1985-06-16T00:00:00",
"phoneNumber": "02106849475",
"email": "ClayTon@Gmail.com",
"medicalInformation": "N/A",
"bankAccount": "11-5723-2835024-110",
"hashedPassword": null
}
]
}
Method: GET
Description: This method is used to add a user to an existing flat with a username
The result code enum
/// <summary>`
/// 0 Default/Nothing`
/// 1 Success`
/// 2 NoUser`
/// 3 NoFlat`
/// 4 UserAlreadyInFlat`
/// 5 UserInOtherFlat`
/// </summary>`
example request URL: https://localhost:44394/api/Flat/AddUserToFlat/TestUser2
STATUS CODE: 200 OK
{
"addedUser": {
"id": 999,
"userName": "TestUser2",
"firstName": "Test",
"lastName": "Test",
"dateOfBirth": "1984-02-09T00:00:00",
"phoneNumber": null,
"email": null,
"medicalInformation": null,
"bankAccount": null,
"hashedPassword": "AQAAAAEAACcQAAAAEBuR1UrmeN466pDREWZHZ7uy8RkhO80iPlMes0vvrWQ4tNEtOIjXQBqyiIAXfnHTFg=="
},
"resultCode": 1
}
Method: POST
Description: This method is used to create a new flat
example request URL: https://localhost:44394/api/Flat/creatFlat/
STATUS CODE: 201
: Able to find the user and create a new flat for them
STATUS CODE: 401
: Not an authorized user
STATUS CODE: 403
: Attempting to create a new flat while already part of one
The JSON representation of the user's newly created flat
{
"flatMembers": [
{
"id": 0,
"userName": "string",
"firstName": "string",
"lastName": "string",
"dateOfBirth": "2020-03-19T07:16:09.584Z",
"phoneNumber": "string",
"email": "string",
"medicalInformation": "string",
"bankAccount": "string",
"hashedPassword": "string"
}
]
}
Method: DELETE
Description: Remove a member out of a flat
example request URL: https://localhost:44394/api/Flat/YinWang
The response body is the flat members. The user have successfully remove her/himself from the flat, and be redirected to create flat page.
StatusCode: 202 ACCEPTED
{
"flatMembers": [
{
"id": 0,
"userName": "BeboBryan",
"firstName": "Bryan",
"lastName": "Ang",
"dateOfBirth": "1984-02-09T00:00:00",
"phoneNumber": "02243926392",
"email": "BryanAng@Gmail.com",
"medicalInformation": "N/A",
"bankAccount": "98-7654-3211234-210",
... (see api/Flat/getMembers)
} ...
]
}
- Home
- Data Model
- Architecture
- API Documentation
- Front End Documentation
- Testing
- Prototyping
- Other
- Contributing Guidelines and Etiquitte
- Labels
- License
- Admin