0% found this document useful (0 votes)
39 views

Webservice API Specification Doc Template

The document outlines an API specification for a restaurant service. It includes sections on authentication methods like login and account verification, as well as API methods for getting updates, deletions, and images. It defines request and response formats, status codes, and other conventions.

Uploaded by

Phạm Trưởng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Webservice API Specification Doc Template

The document outlines an API specification for a restaurant service. It includes sections on authentication methods like login and account verification, as well as API methods for getting updates, deletions, and images. It defines request and response formats, status codes, and other conventions.

Uploaded by

Phạm Trưởng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

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

400 {"error":"Email is exist or null"}

3. 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|<any number>] .The | symbol means OR. If the parameter is [optional], the
default value is shown in blue bold text, as 10 is written in [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

You might also like