Overview

Guide material for API web service using for Structured Programming mini project development process

All the API service will be called via a request (GET, POST) from client side (GET method is available for all services just for development, testing and debugging purposes). Each API service returns data in form of an json array, each request parameter's name must be in lowercase, no special character

Note: the return data is always in form of an json array. Conventionally, the first object is the type of the result ("success", "failure" or  "exception"), the next object(s) is the details of data returned.

Note: data type DateTime is always returned in format "yyyy-MM-ddThh:mm:ss.SSS"

I. User Account

a) Log In

Log into an existing user account with email and password. Possible results:

Request params:

Data returned on "success"

Possible errors on "failure"

A valid request:

http://<host_name>/API/UserAccount/LogIn?email=tranquangduy@gmail.com&password=123456

b) Register

Register new user account using some basic personal information. Possible results:

Request params:

Data returned on "success"

A valid request:

http://<host_name>/API/UserAccount/Register?email=new@gmail.com&password=new&firstname=new&lastname=new

c) Edit

Edit User Account details by giving a specific user id and necessary account info. Possible results:

Request params:

Data returned on "success"

Possible errors on "failure":

A valid request:

http://<host_name>/API/UserAccount/Edit?Id=8A5E25A9-8DFF-4C8F-A736-8527FFCE6CF2&firstname=editted

II. User Stuff

a) Get

Get all stuff belonging to a specific user account. Possible results:

Request params:

Data returned on "success": list of stuffs, each stuff has all the following properties:

Possible errors on "failure":

A valid request:

http://<host_name>/API/UserStuff/Get?Id=8A5E25A9-8DFF-4C8F-A736-8527FFCE6CF2&where=quantity=5&order=Name&offset=2&limit=10

b) Insert

Insert stuff belonging to a specific user account. Possible results:

Request params:

Data returned on "success": last inserted stuff

Possible errors on "failure":

A valid request: http://<host_name>/API/UserStuff/Insert?Id=8A5E25A9-8DFF-4C8F-A736-8527FFCE6CF2&name=iphone5&description=smartphone

c) Update

Update details of an user stuff with information provided in request. Possible results:

Request params:

Data returned on "success":

Possible errors on "failure":

A valid request: http://<host_name>/API/UserStuff/Update?Id=8A5E25A9-8DFF-4C8F-A736-8527FFCE6CF2&name=iphone5edited&description=new smartphone

d) Delete

Delete an existing user stuff. Possible results:

Request params:

Data returned on "success":

Possible errors on "failure":

A valid request: http://<host_name>/API/UserStuff/Delete?Id=8A5E25A9-8DFF-4C8F-A736-8527FFCE6CF2&stuffid=1

e) SetPrice

Set price for an user stuff. Possible results:

Request params:

Data returned on "success" - last edited user stuff:

Possible errors on "failure":

A valid request: http://<host_name>/API/UserStuff/SetPrice?Id=8A5E25A9-8DFF-4C8F-A736-8527FFCE6CF2&stuffid=1&unitprice=100&unittype=USD

II. Shopping

a) Get

Get all stuffs for shopping. Possible results:

Request params:

Data returned on "success": list of stuffs, each stuff has all the following properties:

A valid request:

http://<host_name>/API/Shopping/Get?where=quantity=5&order=Name&offset=2&limit=10