Webservice API Specification Doc Template - Công nghệ Website | Đại học Bách Khoa, Đại học Đà Nẵng

Webservice API Specification Doc Template - Công nghệ Website | Đại học Bách Khoa, Đại học Đà Nẵng giúp sinh viên tham khảo, ôn luyện và phục vụ nhu cầu học tập của mình cụ thể là có định hướng, ôn tập, nắm vững kiến thức môn học và làm bài tốt trong những bài kiểm tra, bài tiểu luận, bài tập kết thúc học phần, từ đó học tập tốt và có kết quả cao cũng như có thể vận dụng tốt những kiến thức mình đã học

API Specification Doc
( )Restaurant Service
Version Date Author Description
1.0 15-10-2023 Truong Pham Initial draft
Index
1. login
Request
Response
2. get updates
Request
Response
3. deletions
Request
Response
4. get recipe image
Request
Response
Conventions
Status Codes
Methods
1. Login
Authenticate the user with the system and obtain the auth_token
Request
Method URL
POST api/auth/login
Type Params Values
Body
Body
username
password
string
string
Response
Status Response
200
{
"id": ,0
"email": ,"string"
"displayName": ,"string"
"firstName": ,"string"
"lastName": ,"string"
"fullName": ,"string"
"accountStatus": ,0
"dayOfBirth": ,"2023-10-15T07:11:59.843Z"
"gender": ,0
"phoneNumber": ,"string"
"address": ,"string"
"token": "string"
}
400 {"error":"UserName is Null"}
400 {"error":"Password is null"}
401
{"error":"Wrong username or password"}
401 {"error":"Account is inactive”}
2. Register Account
Request
Method URL
POST api/users/create-account
Type Params Values
Body
Body
Email
User_type
String
int
Response
3.
Send mail to verify account
Request
Method URL
POST api/auth/send-mail-to-verify-account
Type Params Values
HEAD auth_key string
Status Response
200 Success
400 {"error":"Email is exist or null"}
Response
Status Response
200
success
400
{" "}error":"Account is verified
400
{" ":"error Account is inactive"}
401 {"error":"Invalid Auth key."}
4. Verify Account
Request
Method URL
POST api/auth/verify-account
Type Params Values
Body token string
Response
Status Response
200
Success
401 {"error":"Invalid token."}
Glossary
Conventions
Client - Client application.
Status - HTTP status code of response.
All the possible responses are listed under ‘Responses’ for each method. Only one of them
is issued per request server.
All response are in JSON format.
All request parameters are mandatory unless explicitly marked as [optional]
The type of values accepted for a parameter are shown the the values column like request
this .The symbol means . If the parameter is , the [10|<any number>] | OR [optional]
default value is shown in blue bold text, as is written in .10 [10|<any number>]
Status Codes
All status codes are standard HTTP status codes. The below ones are used in this API.
2XX - Success of some kind
4XX - Error occurred in client’s part
5XX - Error occurred in server’s part
Status Code Description
200 OK
201 Created
202 Accepted (Request accepted, and queued for execution)
400 Bad request
401 Authentication failure
403 Forbidden
404 Resource not found
405 Method Not Allowed
409 Conflict
412 Precondition Failed
413 Request Entity Too Large
500 Internal Server Error
501 Not Implemented
503 Service Unavailable
| 1/8

Preview text:

API Specification Doc
(Restaurant Service) Version Date Author Description 1.0 15-10-2023 Truong Pham Initial draft Index 1. login Request Response 2. get updates Request Response 3. deletions Request Response 4. get recipe image Request Response Conventions Status Codes Methods 1. Login
Authenticate the user with the system and obtain the auth_token Request Method URL POST api/auth/login Type Params Values Body username string Body password string Response Status Response 200 { "id": 0, "email": , "string" "displayName": "string", "firstName": "string", "lastName": , "string" "fullName": , "string" "accountStatus": 0,
"dayOfBirth": "2023-10-15T07:11:59.843Z", "gender": 0, "phoneNumber": "string", "address":
, "string" "token": "string" } 400 {"error":"UserName is Null"} 400 {"error":"Password is null"} 401
{"error":"Wrong username or password"} 401
{"error":"Account is inactive”} 2. Register Account Request Method URL POST api/users/create-account Type Params Values Body Email String Body User_type int Response Status Response 200 Success 3. 400
{"error":"Email is exist or null"}
Send mail to verify account Request Method URL POST
api/auth/send-mail-to-verify-account Type Params Values HEAD auth_key string Response Status Response 200 success 400
{"error":"Account is verified"} 400
{"error":" Account is inactive"} 401 {"error":"Invalid Auth key."} 4. Verify Account Request Method URL POST api/auth/verify-account Type Params Values Body token string Response Status Response 200 Success 401 {"error":"Invalid token."} Glossary Conventions
Client - Client application.
Status - HTTP status code of response.
All the possible responses are listed under ‘Responses’ for each method. Only one of them is issued per request server.
All response are in JSON format.
All request parameters are mandatory unless explicitly marked as [optional]
The type of values accepted for a request parameter are shown the the values column like
this [10|] .The | symbol means OR. If the parameter is [optional], the
default value is shown in blue bold text, as 10 is written in [10 . |] Status Codes
All status codes are standard HTTP status codes. The below ones are used in this API. 2XX - Success of some kind
4XX - Error occurred in client’s part
5XX - Error occurred in server’s part Status Code Description 200 OK 201 Created 202
Accepted (Request accepted, and queued for execution) 400 Bad request 401 Authentication failure 403 Forbidden 404 Resource not found 405 Method Not Allowed 409 Conflict 412 Precondition Failed 413 Request Entity Too Large 500 Internal Server Error 501 Not Implemented 503 Service Unavailable