标签:
本文档是校园共享平台collegeshare数据服务接口文档(JXAPIS),供产品和技术开发团队进行产品开发参考使用。
主要服务为三个,分别为:大咖有约(type_id:1),才艺互教(type_id:2),帮过考试(type_id:3)
作者:见校技术团队
版本:v1.0
创建时间:2016.6.29
1.1 Methods
1.2. Status Codes
1.3. Request Parameters
多数请求所必须的参数已经被写入到 HTTP HEADER 。请参考 HTTP HEADER 部分。
所请求返回数据包含列表,需向服务器提交以下两个参数:
1.4. Response Envelope
全部接口的请求返回遵循统一的返回格式,包含“result”、“data”、“cursor”、“success”、“errors”等部分。查看下表,了解个部分具体说明:
样例:
{
"result": "ok"
"data":[
{
"id": 12306,
"title": "这是一个文章标题",
"summary": "这是一个文章的摘要"
},
{
"id": 12306,
"title": "这是一个文章标题",
"summary": "这是一个文章的摘要"
},
]
"cursor":{
"total": 100,
"offset": 10,
"limit": 10
}
"success": "成功操作",
"errors": [
{
"field": "username",
"message": "Bad Authentication data"
},
{
"field": "password",
"message": "Bad Authentication data"
},
]
}
result
返回“result”仅仅包含两个结果:“ok”和“not_ok”。返回结果和状态码无关,仅仅表明了接口是否按请求方的预期完成。 比如,客户端请求修改某用户的个人信息,客户端提交的信息在服务器验证后有两项信息不符合验证条件,因此整个操作失败。 此时,http返回的状态码为“422”,result为“not_ok”。
cursor
返回“cursor”包括:total current per_page。
success
如果接口操作成功,如果有成功的提示信息,在“success”部分输出。
errors
当客户端向接口的请求失败,“errors”用来返回具体错误信息。“errors”包含了一个数组,每一个数组包括了一个具体的错误对象。 每一个具体的错误对象都包含了“错误信息”(message)和“错误字段”(field)。如果错误信息没有针对一个具体的错误字段, 错误字段的赋值为空。
1.5. Authentification
1.6. HTTP Header
请求参数
Request
##Headers
Content-Type: application/json
##Body
{
"username": "cindy",
"email": "13064538038",
"password": "l2220167",
"captcah_id": 12,
"captcha_word": "45CWTS"
}
Response 201
##Headers
Content-Type: application/json
##Body
{
"result": "ok",
"data":{},
"cursor":{},
"success": "用户创建成功!",
"errors": []
}
请求参数
request
##Headers:
Content-Type: application/json
##body
{
"client_id":23435123232,
"client_secret":"0186114ea30bc5b5178301f206eb0bbc",
"login": "13065469273",
"password": "l2220167",
"captcha_id": 13,
"captcha_word": "AWTUES",
"grant_type": "password"
}
Response 200
##Headers
Content-Type: application/json
##Body
{
"result": "ok",
"data":{
"access_token":"0186114ea30bc5b5178301f206eb0bbc",
"user_unique_key":"9986114ea30bc5e5178301f206eb0bab",
"expiration": 23435123232
},
"cursor":{},
"success": "",
"errors": []
}
请求参数
encrypted_code - 登陆验证密串
Request
Headers:
Content-Type: application/json
Body:
{
"encrypted_code":"JBBNKL232AKJSALSA3495690JDSKAJSASDASBMNDMN4545ASNDMBASDA65656S6565656534343434DASDASDASD",
}
Response 200
Headers:
Content-Type: application/json
Body
{
"result": "ok",
"data":{
"access_token": "941df22661ee682774e4b7e4bb5261c669579c38",
"user_unique_key": "c2syn3k6tQThYLF3kNfzFS8OqZukIB1",
"expiration": "1439618283",
"user_guid": 1999912
},
"cursor":{},
"success": "",
"errors": []
}
如果用户不能以微信账号登录,result = “not_ok”。返回 errors,包括如下情况:
请求参数
返回数据
access_token
如果用户登录成功,返回 access_token 字符串;否则返回空
user_unique_key
expiration
Request
Header:
Content-Type: application/json
Body:
{
"wechat_access_token": "0186114ea30bc5b5178301f206eb0bbc",
"wechat_openid": 2323123234,
"wechat_expired_in": "7200",
}
Response 200
Header:
Content-Type: application/json
Body
{
"result": "ok",
"data":{
"access_token":"0186114ea30bc5b5178301f206eb0bbc",
"user_unique_key": "9986114ea30bc5e5178301f206eb0bab",
"expiration": 2323123234,
"if_email_update_reminded":TRUE
},
"cursor":{},
"success": "",
"errors": []
}
Response 406
Headers:
Content-Type: application/json
如果该微信未授权过,则会出现如下错误
{
"result": "no_ok",
"data": {},
"cursor": {},
"success": "",
"errors": [
{
"field": "reg",
"message": "您是第一次授权,请先创建账号"
}
]
}
请求参数
Request
Headers:
Content-Type: application/json
Body:
{
"device_token": "0186114ea30bc5b5178301f206eb0bbc",
}
Response 200
Headers:
Content-Type: application/json
{
"result": "ok",
"data":{},
"cursor":{},
"success": "",
"errors": []
}
默认属性
设置属性(public)
设置属性(private)
请求参数
Response 200
Headers:
Content-Type: application/json
Body:
{
"result": "ok",
"data": {
"user_guid": "184984"
},
"cursor": {},
"success": "",
"errors": []
}
请求参数
Request
Headers:
Content-Type: application/json
Body:
{
"fields":"avatar
"avatar_size":["50_50"]
}
Response 200
Headers:
Content-Type: application/json
Body:
{
"result": "ok",
"data":[
{
"username":"zhangchiliang",
"avatar":"http://103.59.128.147/20004/avatar.jpg",
"signature":"i am yours",
"number_of_posts":233,
"score":12.34,
"rank":2309,
"level":名震江湖
}
],
"cursor":{},
"success": "",
"errors": []
}
请求参数
Request
Headers:
Content-Type: application/json
{
Body:
"total":20,
"fields":"avatar;signature;number_of_(待填)"
}
Response
Headers:
Content-Type: application/json
Body
{
"result": "ok",
"data":[
{
"username":"zhangchiliang",
"last_post_time_updated":34123234342424,
"avatar":"http://103.59.128.147/23223232/avatar.jpg"
},
{
"username":"mengcong",
"last_post_time_updated":34123234342424,
"avatar":"http://103.59.128.147/23223232/avatar.jpg"
}
],
"cursor":{
"total": 2
},
"success": "",
"errors": []
}
请求参数
Response 200
Headers:
Content-Type: application/json
Body:
{
"result": "ok",
"data":[
[
{
"service_guid":192024,
"title":"这是服务标题",
"type_id":1
"time_published":1306836623,
"time_created":1306836623,
"time_updated":1306836623,
"time_bookmarked":13606836623,
},
{
"post_guid":192024,
"title":"这是服务标题",
"type_id":2
"time_created":1306836623,
"time_updated":1306836623,
"time_bookmarked":13606836623,
}
]
],
"cursor":{
"total":2,
"offset":0,
"limit":10
},
"success": "",
"errors": []
}
请求参数
Request
Header:
Content-Type: application/json
Body:
{
"new_signature":"我的新签名"
}
Response 200
{
"result": "ok",
"data":{},
"cursor":{},
"success": "",
"errors": []
}
Response 200
Headers:
Content-Type: application/json
Body:
{
"result": "ok",
"data":{
"url":"http://103.59.128.147:5000/332/343.jpg"
},
"cursor":{},
"success": "",
"errors": []
}
请求参数
Request
Headers
Content-Type: multipart/form-data
Body
{
"avatar":"二进制乱码"
}
Response 200
Headers:
Content-Type: application/json
Body
{
"result": "ok",
"data":{
"url":"http://103.59.128.147:5000/332/343.jpg"
},
"cursor":{},
"success": "",
"errors": []
}
请求参数
- username - 必填
Response 200
Headers:
Content-Type: application/json
Body
{
"result": "ok",
"data":[
{
"user_guid":1234,
"username":"zhangchiliang",
"avatar": "/user/zhangchiliang/avatar1232_30_30.jpg"
"time_letter_last_updated":3432344553
"letter_last_updated":"吉他一次能教几首歌呢"
},
{
"user_guid":1234,
"username":"mcong",
"avatar": "/user/mcong/avatar1232_30_30.jpg"
"time_letter_last_updated":3432342355
"letter_last_updated":"小提琴一次能教几首歌呢"}
]
"cursor":{},
"success": "",
"errors": []
}
请求参数
返回数据
Request
Headers:
Content-Type: application/json
Body:
{
"sorting_type":1
}
Response 200
Headers:
Content-Type: application/json
Body:
{
{
"result": "ok",
"data":[
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
],
"cursor":{
"total":400,
"offset":0,
"limit":10
},
"success": "",
"errors": []
}
}
请求参数
返回数据
Request
Headers:
Content-Type: application/json
Body:
{
"sorting_type":1
}
Response 200
Headers:
Content-Type: application/json
Body:
{
{
"result": "ok",
"data":[
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
],
"cursor":{
"total":400,
"offset":0,
"limit":10
},
"success": "",
"errors": []
}
}
请求参数
返回数据
Request
Headers:
Content-Type: application/json
Body:
{
"sorting_type":1
}
Response 200
Headers:
Content-Type: application/json
Body:
{
{
"result": "ok",
"data":[
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
],
"cursor":{
"total":400,
"offset":0,
"limit":10
},
"success": "",
"errors": []
}
}
请求参数
说明:keyword在被传输到API前,需要做encode处理
返回数据(此处response有问题,待修改)
Request
Headers:
Content-Type: application/json
Body:
{
"keyword":"产品经理实习"
}
Response 200
Headers:
Content-Type: application/json
Body:
{
{
"result": "ok",
"data":[
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
{
"relevance":90.1,
"service_guid":3422,
"time_published":1306836623,
"title":"大学如何积累含金量高的实习",
"author":
{
"author_guid":23,
"author":"习近平",
"author_avatar":"http://103.59.128.147:5000/xijp/avatar.jpg"
"author_identity":"一个走上仕途的清华忧郁男人"
}
"times_wish":54
"times_meet":69
},
],
"cursor":{
"total":400,
"offset":0,
"limit":10
},
"success": "",
"errors": []
}
}
Response 200
Headers:
Content-Type: application/json
Body:
{
"result": "ok",
"data":{
"post_guid":198613,
"title":"如何积累含金量高的实习",
"status":"processing",
"time_wish":50
"time_meet":69
"service_money":50
"meet_place":"线上"
"meet_time":"周日十点"
"time_created":1395159177,
"time_updated":31395159177,
"time_published":1395629311,
"if_current_user_bookmarked":FALSE,
"service_recommend_guid":9304,
"main":"这里是服务的主要内容,作者的牛(zhuang)逼历史,等等",
"author":
{
"guid": "233657",
"username": "常宁",
"user_identity": "中国传媒大学博士",
"avatar": null,
"user_university":"东北大学"
"user_desc":"大家好,我是习近平"
},
"number_of_bookmarks":12,(次数有必要?)
"number_of_comments":34,
},
"cursor":{},
"success": "",
"errors": []
}
Response 200
Headers:
Content-Type: application/json
Body:
{
"result":"ok",
"data":{},
"cursor":{},
"success": "",
"errors": []
}
Response 200
Headers:
Content-Type: application/json
Body:
{
"result":"ok",
"data":{},
"cursor":{},
"success": "",
"errors": []
}
请求参数
Request
Headers:
Content-Type: application/json
Body:
{
"social_media":"sina_weibo"
}
Response 200
Headers:
Content-Type: application/json
Body:
{
"result": "ok"
"data":{}
"cursor":{}
"success": "",
"errors": []
}
Response 200
Headers:
Content-Type: application/json
Body:
{
"result": "ok",
"data":[
[
{
"service_guid":192024,
"title":"院士面对面",
"type_id":1
"time_published":1306836623,
"time_created":1306836623,
"time_updated":1306836623,
"status":"published"
},
{
"service_guid":192025,
"title":"本专业的秘密",
"type_id":2
"time_published":1306836623,
"time_created":1306836623,
"time_updated":1306836623,
"status":"published"
}
]
],
"cursor":{
"total":2,
"offset":0,
"limit":10
},
"success": "",
"errors": []
}
请求参数
Request
Headers:
Content-Type: application/json
Response 201
Headers:
Content-Type: application/json
Body:
{
"result": "ok",
"data": {},
"cursor": {},
"success": "",
"errors": []
}
标签:
原文地址:http://blog.csdn.net/qq_33232071/article/details/51792499