1. API Specification Doc
( YUHN API v0.4)
Version
Date
Author
Description
0.1
09/10/2013
ThuongNV
Initial
0.3
09/25/2013
AnhNvt
Update
0.4
09/30/2013
ThuongNV
Update
2. Table of Contents
1) GET EVENTS //OK
REQUEST
RESPONSE
2) GET POSTS //OK
REQUEST
RESPONSE
3) GET LIST ALBUM //OK
REQUEST
RESPONSE
4) GET ALBUM CONTENT //OK
REQUEST
RESPONSE
5) GET SURVEY //OK
REQUEST
6) GET QUESTION OF A SURVEY //UPDATE
REQUEST
7) GET GALLERY OF EVENT //OK
REQUEST
RESPONSE
CONVENTIONS
STATUS CODES <NO USE>
3
3
3
4
4
4
4
4
5
5
5
6
6
6
7
7
8
8
8
9
9
3. Methods
1) Get events //OK
Lấythông tin danhsáchcácsựkiện ,sắpxếptheothứtựtừmớiđếncũ, phântrang (20 bảnghi/1trang )
Request
Params
Value
data
{handle:"on_get_events","page":1}
Response
Status
Response
200
An array of events.
[
{ "EventID":99,
"EventTitle":"",
"EventDescription":"",
"EventContent":"webview Link",
"Location":"",
"TimeStart":"10/09/2013 10:20:20",
"TimeEnd":"10/09/2013 10:20:20",
"TimeCreate":"10/09/2013 10:20:20",
“Image”:http://www.img.com,
“ImageThumb”:”imgurl”,
“UserCreate”:””,
"Avatar": "https://abc.xyz.com”,
"FullName": "NguyễnDuyĐức"
“FeedID”:”123”,
//Thieu
“Views”:12,
“Status”:1,
}, {},{},..
]
404
{"error":"no event found"}
4. 2) Get Posts//OK
Lấythông tin danhsáchcácbàiviết
Request
Params
Values
Data
{handle:"on_get_posts","page":1}
Response
Status
Response
200
An array posts of posts
[
{ "PostID":1,
“PostTitle”:””,
"PostDescription":"http://abc.com/image.jpg",
“PostContent”:”infor of content”,
“DateCreate”:”20/10/2013”,
“Image”:”http://abc.com/image.jpg”,
“ImageThumb”:”http://abc.com/image.jpg”,
“Views”:123
“Status”:1,
“FeedID”:”12312312”,
“UserCreate”:12,
"Avatar": "https://abc.xyz.com”,
"FullName": "NguyễnDuyĐức"
}, {},{},..
]
404
{"error”: “no gallery not found"}
3) Get list album //OK
Lấy thong tin danhsachhinhanhcủa gallery
Request
5. Params
Values
Data
{handle:"on_get_medias"}
Response
Status
Response
200
1 arrays of medias.
[
{ "MediaID":1,
"MediaTitlte":””,
"MediaDescription”:”Description of the album”,
“Views”:15,
“Image”:””,
“ImageThumb”:”http://abc.com/image.jpg”,
“Status”:1,
“AccountCreate”:””,
"Avatar": "https://abc.xyz.com”,
"FullName": "NguyễnDuyĐức",
“DateCreate”:”20/10/2013”,
“FeedID”:””
}, {},{},..
]
404
{"error”: “Noalbum found"}
4) Get album content //Update
Lấytấtcả thong tin hìnhảnh, video của 1 album
Request
Params
Values
Data
{handle:"on_get_mediadetail", "MediaID":1}
6. Response
Status
Response
200
2 arrays of images and videos.
[
{ "MediaDetailID":1,
"MediaDetailTitle":””,
"MediaLink":123,
“MediaID”:12,
"MediaType”:1, //1:Ạnh,2:Video
"DateCreate”:””,
“Status”:1,
“FeedID”:”12312312”,
“AccountCreate”:123,
"Avatar": "https://abc.xyz.com”,
"FullName": "NguyễnDuyĐức",
“Views”:1212//News
}, {},{},..
]
404
{"error”: “No media found"}
5) Get survey//OK
Lấythông tin danhsáchcáccuộcthicủamộtsựkiệnnàođó
Request
Params
Values
data
{handle:"on_get_survey","EventID":1}
Status
Response
200
Arraysurveys òf a event
8. “AnswersTitle”:””,
},{},{},…
]
},{},{},…
]
404
{"error”: “No question found"}
7) Get gallery of Event//OK
Lấytấtcảhìnhảnh, video của 1 sukien
Request
Params
Values
Data
{handle:"on_get_eventmedia","EventID":1}
Response
Status
Response
200
An array of eventmedia
[
{ "MediaID":1,
"MediaTitle":””,
"MediaType":123,
“EventID”:12,
"MediaDescription”:1, //1:Ạnh,2:Video
"DateCreate”:””,
“Views”:1,
“Image”:””,
"ImageThumb": "https://abc.xyz.com”,
"FullName": "NguyễnDuyĐức",
“FeedID”:””,
9. "Avatar":"https://cdn2.iconfinder.com/data/icons/piconsessentials/57/user-256.png",
“Status”:1
}, {},{},..
]
404
{"error”: “No media found"}
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 is 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 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 10are written in [10|<any number>].
Status Codes<No Use>
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
10. 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