api docs v3.0

12
API Specification Doc ( YUHN API v0.3) Version Date Author Description 0.1 09/10/2013 ThuongNV Initial 0.3 09/25/2013 AnhNvt Update

Upload: anh-tuan

Post on 25-May-2015

73 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Api docs v3.0

API Specification Doc

( YUHN API v0.3)

Version Date Author Description

0.1 09/10/2013 ThuongNV Initial

0.3 09/25/2013 AnhNvt Update

Page 2: Api docs v3.0

Table of Contents1) GET EVENTS 3REQUEST 3RESPONSE 32) GET POSTS // UPDATE 4REQUEST 4RESPONSE 43) GET LIST ALBUM //NEW 5REQUEST 5RESPONSE 54) GET ALBUM CONTENT // UPDATE 6REQUEST 6RESPONSE 65) GET SURVEY //UPDATE 7REQUEST 76) GET QUESTION OF A SURVEY //UPDATE 7REQUEST 87) GET GALLERY OF EVENT / 8CONVENTIONS 9STATUS CODES <NO USE> 9

Page 3: Api docs v3.0

Methods

1) Get events

Lấy thông tin danh sách các sự kiện ,sắp xếp theo thứ tự từ mới đến cũ.

Request

Params Value

data {handle:”on_get_events”,”page”:1}

Response

Status Response

Page 4: Api docs v3.0

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”:” img url”, “UserCreate”:””, "Avatar": "https://abc.xyz.com”, //Thieu "FullName": "Nguyễ5n Duy Đức" //Thieu “FeedID”:”123”, //Thieu “Views”:12, “Status”:1,}, {},{},..]

404 {"error":"no event found"}

2) Get Posts // Update

Lấy thông tin danh sách các bài viết

Request

Params Values

Data {handle:”on_get_posts”,”page”:1}

Response

Status Response

200 An array posts of category[ { "PostID":1,

Page 5: Api docs v3.0

“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, //Thieu "Avatar": "https://abc.xyz.com”, "FullName": "Nguyễ5n Duy Đức" }, {},{},..]

404 {"error”: “no gallery not found"}

3) Get list album //New

Lấy thong tin hình ảnh, video của media

Request

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, “Images”:””, “ImagesThumb”:” http://abc.com/image.jpg ”, “Status”:1,

Page 6: Api docs v3.0

“AccountCreate”:””, "Avatar": "https://abc.xyz.com”, "FullName": "Nguyễ5n Duy Đức", “DateCreate”:”20/10/2013” }, {},{},..]

404 {"error”: “No album found"}

4) Get album content // Update

Lấy tất cả hình ảnh, video của 1 album

Request

Params Values

Data {handle:" on_get_mediadetail”, "MediaID":123}

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”, //New “AccountCreate”:123, "Avatar": "https://abc.xyz.com”, //New "FullName": "Nguyễ5n Duy Đức", //New}, {},{},..

Page 7: Api docs v3.0

]

404 {"error”: “No media found"}

5) Get survey //OK

Lấy thông tin danh sách các cuộc thi của một sự kiện nào đó

Request

Params Values

data {handle:”on_get_survey”,”EventID”:1}

Status Response

200 Array surveys òf a event[{ "SurveyID":1, "SurveyTitle":"cuoc thi tim hieu ve HCM", "SurveyDescription":"cuoc thi tim hieu ve HCM", “Image”:1, “ImageThumb”:” http://abc.com/image.jpg” “Joins”:111, “Status”:1},{},{},…]

404 {"error”: “No survet found"}

6) Get question of a survey //Update

Lấy thông tin danh sách các câu hỏi của 1 cuộc thi nào đó

Page 8: Api docs v3.0

Request

Params Values

data {handle:”on_get_question”,”SurveyID”:1}

Status Response

200 Array questions of a survey[{ "QuestionID":1, "QuestionTitle":"Cau hoi 1", "QuestionType":1, "SurveyID":1, “Status”:1, “Answers”: //New [{ “AnswerID”:1, “AnswersTitle”:””, },{},{},… ]},{},{},…]

404 {"error”: “No question found"}

7) Get gallery of Event

Lấy tất cả hình ảnh, video của 1 su kien

Request

Page 9: Api docs v3.0

Params Values

Data {handle:" on_get_eventmedia”, "EventID":123}

Response

Status Response

200 2 arrays of images and videos.[ { "MediaID":1, "MediaTitle":””, "MediaType":123, “EventID”:12, "MediaDescription”:1, //1:Ạnh,2:Video "DateCreate”:””, “Views”:1, “Image”:””, "ImageThumb": "https://abc.xyz.com”, "FullName": "Nguyễ5n Duy Đức", “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]

Page 10: Api docs v3.0

● 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 10 are 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 kind4XX - Error occurred in client’s part5XX - 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