-
Notifications
You must be signed in to change notification settings - Fork 2
API Return Template
qmo1222 edited this page Jul 10, 2017
·
4 revisions
The API will return in JSON format.
Every return JSON should include the following 4 entries.
-
uid
: The unique id of target user -
object
: Object type of target object, which is same as api path -
action
: Action to the target object, which is same as api path -
brea
: Status code, 0 is correct. -
server_time
: Server time with UTC+8.
An alternative payload is sent back if there's some query information.
-
payload
: The return information of target object
In some read api, if not designate id, it will return a list of items.
There are always 2 entries in payload.
-
type
: Type of payload, eitherAttribute Name
orObjects
-
attribute name
: Value of correspondingattribute name
, whereattribute name
can bestatus
,mid
,tid
etc. Only exists whentype
beAttribute Name
. -
Objects
: Whole objects attributes key/value pair.
Return JSON of /api/v1/member/callhelp
{
"uid": 86,
"object": "member",
"action": "callhelp",
"brea": 0,
"server_time": "2017-04-01T14:38:29.765Z"
}
Return JSON of /api/v1/report/create
{
"uid": 34,
"object": "report",
"action": "create",
"brea": 0,
"server_time": "2017-04-01T14:38:29.765Z",
"payload":{
"type": "Attribute Name",
"rid": 16
}
}
Return JSON of /api/v1/mission/read
(requesting mid 12)
{
"uid": 34,
"object": "report",
"action": "create",
"brea": 0,
"server_time": "2017-04-01T15:24:59.987Z",
"payload":{
"type": "Objects",
"objects": [
{
"mid": 12,
"title": "證人救出",
"content": "證人Jacky快要被黑暗組織逮捕啦!! 快去湖心亭將Jacky帶回總部 blah blah blah",
"time_start": "14:03",
"time_end": "14:23",
"price": 1500,
"clue": 8,
"class": "MAIN",
"score": 20,
"location_e": 120.995106,
"location_n": 24.794090
}
]
}
}
Return JSON of /api/v1/mission/read
(No designate mid
{
"uid": 34,
"object": "report",
"action": "create",
"brea": 0,
"server_time": "2017-04-01T15:24:59.987Z",
"payload":{
"type": "Objects",
"objects": [
{
"mid": 12,
"title": "證人救出",
"content": "證人Jacky快要被黑暗組織逮捕啦!! 快去湖心亭將Jacky帶回總部 blah blah blah",
"time_start": "14:03",
"time_end": "14:23",
"price": 1500,
"clue": 8,
"class": "MAIN",
"score": 20,
"location_e": 120.995106,
"location_n": 24.794090
},
{
"mid": 15,
"title": "抓住證人",
"content": "證人Jacky發瘋了! 找到他將他制伏",
"time_start": "14:15",
"time_end": "14:30",
"price": 1100,
"clue": 10,
"class": "SUB",
"score": 10,
"location_e": 0,
"location_n": 0
}
]
}
}
Return JSON of /utility/0
{
"status": 0,
"object": [
{
"team": 1,
"name": "No name",
"nickname": "No nickname",
"phone": "0900000000"
},
{
"team": 2,
"name": "Hi",
"nickname": "Blablabla",
"phone": "0911111111"
}
]
}
-
status
is for returning status recognition. 0 for success and >0 for error. -
name
for squad leader's real name andnickname
for nickname. -
team
for squad id. The possible id will be 1~12. -
phone
for the leader's cell phone number without dash -