[TOC]
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
0 | Successful | system.success | 成功 |
200 | OK | system.success | 成功 |
403 | Unauthorized | system.exception | 未授权 |
404 | Not found | system.exception | 无法找到资源 |
100001 | Internal error | system.common | 内部错误 |
100002 | Unknown error | system.common | 未知错误 |
100003 | Database error | system.common | 数据库错误 |
100004 | Validation failed | system.common | 验证失败 |
100005 | Mail sending failed | system.common | 邮件发送失败 |
100006 | Invalid parameter | system.common | 无效参数 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
200001 | POST method required | api.common | POST方法提交 |
200002 | Invalid captcha | api.common | 无效验证码 |
OAuth2.0 authorize api
url: /api/Oauth/authorize
method: GET
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
response_type | string | true | json OR code |
client_id | string | true | 申请应用时分配的AppKey |
redirect_uri | string | true | 授权回调地址,站外应用需与设置的回调地址一致,站内应用需填写canvas page的地址 |
scope | string | false | 申请scope权限所需参数,可一次申请多个scope权限,用逗号分隔 |
state | string | false | 用于保持请求和回调的状态,在回调时,会在Query Parameter中回传该参数。开发者可以用这个参数验证请求有效性,也可以记录用户请求授权页前的位置。这个参数可用于防止跨站请求伪造(CSRF)攻击 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
201101 | The redirect_uri and client_id are required | api.Oauth.authorize | 参数redirect_uri和client_id不可为空 |
201102 | Invalid response_type | api.Oauth.authorize | 参数response_type无效 |
201103 | Invalid clientid | api.Oauth.authorize | 参数clientid无效 |
201104 | The redirect_uri and client_id are not matched | api.Oauth.authorize | 参数redirect_uri和client_id不匹配 |
201105 | The authorization code required | api.Oauth.authorize | 授权码不可为空 |
请求 https://www.upare.com/apis/Oauth/authorize/?client_id=123050457758183&redirect_uri=http://www.example.com/response&response_type=code
同意授权后会重定向 http://www.example.com/response&code=CODE
{"error_code":0,"api_uri":"apis/Oauth/authorize","message":"Successful","authorization_code":"a7cbae5f75ea7514ed963182d8ae43f71dcb1e88"}
authorization_code (string): 用于提交到access_token接口的code
######Usage: Get the access_token
url: /api/Oauth/accessToken
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
client_id | string | true | 申请应用时分配的AppKey |
client_secret | string | true | 申请应用时分配的AppSecret |
grant_type | string | true | 请求的类型,填写authorization_code/refresh_token/password |
redirect_uri | string | true | 回调地址,需需与注册应用里的回调地址一致 |
code | string | false | grant_type为authorization_code时,调用/apis/Oauth/authorize获得的code值 |
refresh_token | string | false | grant_type为refresh_token时,通过授权得到的refhresh_token刷新access_token |
username | string | false | grant_type为password时,系统用户名 |
password | string | false | grant_type为password时,系统密码 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
201201 | Invalid access_token | api.Oauth.accessToken | 参数access_token无效 |
201202 | The access_token is required | api.Oauth.accessToken | 参数access_token不可为空 |
201203 | The access_token expires or does not exist | api.Oauth.accessToken | 参数access_token过期或不存在 |
201204 | The API requests out of rate limit | api.Oauth.accessToken | 接口请求超限 |
201205 | The client_id, client_secret, grant_type, redirect_uri are not matched | api.Oauth.accessToken | 参数client_id, client_secret, grant_type, redirect_uri不匹配 |
201206 | The API permission denied | api.Oauth.accessToken | 无权访问该接口 |
201207 | Cache access_token failed | api.Oauth.accessToken | 缓存access_token失败 |
201208 | The client_id and client_secret are not matched | api.Oauth.accessToken | 参数client_id和client_secret不匹配 |
201209 | Invalid refresh_token | api.Oauth.accessToken | 参数refresh_token无效 |
201210 | The client_id is required | api.Oauth.accessToken | 参数client_id不可为空 |
201211 | The client_secret is required | api.Oauth.accessToken | 参数client_secret不可为空 |
201212 | The username and password are required | api.Oauth.accessToken | 用户名和密码不可为空 |
201213 | Invalid client_id | api.Oauth.accessToken | 参数client_id无效 |
201214 | The client_id and username are not matched | api.Oauth.accessToken | 参数client_id和用户名不匹配 |
201215 | Invalid authorization code | api.Oauth.accessToken | 授权码无效 |
201216 | Invalid grant_type | api.Oauth.accessToken | 参数grant_type无效 |
{"error_code":0,"api_uri":"URI","access_token": "ACCESS_TOKEN","refresh_token": "REFRESH_TOKEN","expires_in": 1234,"remind_in":3600,"uid":12341234}
access_token (string): 用户授权的唯一票据,用于调用开放接口,同时也是第三方应用验证用户登录的唯一票据,第三方应用应该用该票据和自己应用内的用户建立唯一影射关系,来识别登录状态,不能使用本返回值里的UID字段来做登录识别。
refresh_token (string): grant_type为refresh_token时可通过refresh_token获得access_token。
expires_in (int): access_token的生命周期,单位是秒数。
url: /api/Oauth/delete
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
access_token | string | true |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
201301 | Failed to delete access_token | api.Oauth.delete | 删除access_token失败 |
url: /api/Oauth/revoke
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
access_token | string | true |
{"error_code":0,"api_uri":"URI"}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
201401 | Failed to revoke access_token | api.Oauth.revoke |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
202001 | The account does not exist | api.User.common | 账户不存在 |
202002 | The username already exists | api.User.common | 该账户已存在 |
202003 | The email already exists | api.User.common | 该邮件地址已存在 |
202004 | The phone number already exists | api.User.common | 该电话号码已存在 |
202005 | The Nick name already exists | api.User.common | 该昵称已存在 |
202006 | Invalid verification code | api.User.common | 验证码无效 |
202007 | The sending interval of verification code is %d seconds | api.User.common | 发送间隔为%d秒 |
202008 | Failed to send verification code | api.User.common | 发送验证码失败 |
202009 | Invalid communication method | api.User.common | 无效的通讯方式 |
url: /api/User/login
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
username | string | true | 用户名 |
password | string | true | 密码 |
captcha | string | true | /api/Image/captcha 接口产生的验证码 |
remember | boolean | false | 是否永久登录 |
{"error_code":0,"api_uri":"URI","login_token":"TOKEN","uid":UID}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
202101 | Not logged in yet | api.User.login | 尚未登录 |
202102 | Username and password are required | api.User.login | 用户名密码不可为空 |
202103 | Incorrect password | api.User.login | 密码错误 |
url: /api/User/register
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
username | string | true | 用户名 |
password | string | true | 密码 |
string | true | 邮箱 |
{"error_code":0,"api_uri":"URI","login_token":"TOKEN","uid":UID}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
202202 | Failed to register | api.User.register | 注册失败 |
url: /api/User/setAvatar
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
avatar | file | true | 头像 |
action | string | false | list/delete/active |
{"error_code":0,"api_uri":"URI"}
The image format must be jpg or png (图片格式应该是jpg或png); File requirements are image types (文件类型应该是图片); The image background should be white (图像背景应该是白色); The file size should be between 40KB and 2MB (文件应该在40KB到2MB之间); The image width should between 412 pixels and 600 pixels (图像宽在:412 - 600像素之间); The image height should between 578 pixels and 800 pixels (图像高在:412 - 600像素之间);
url: /api/User/modifyBasicInfo
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
newpassword | string | false | 新密码 |
confirm | string | relevance | 新密码确认,输入密码则为必填 |
nickname | string | false | 昵称 |
string | false | ||
phone | string | false | phone |
captcha | string | true | /api/Image/captcha 接口产生的验证码 |
{"error_code":0,"api_uri":"URI"}
url: /api/User/modifyDetailInfo
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
realname | string | false | 真实姓名 |
idcard | string | false | 身份证号 |
address | string | false | 地址 |
gender | string | false | 性别 |
nation | string | false | 民族 |
postalcode | string | false | 邮编 |
departmentcode | string | false | 部门编号 |
majorcode | string | false | 专业编号 |
leader | string | false | 领导姓名 |
{"error_code":0,"api_uri":"URI"}
url: /api/User/unbind
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
channel | string | false | 社会化登录的频道名称,如weibo,qq |
{"error_code":0,"api_uri":"URI"}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
100004 | Validation failed | system.common | 上传验证失败(原因) |
202301 | Fail to upload avatar | api.User.setting | 头像更新失败 |
202302 | Fail to unbind SNS account | api.User.setting | 解绑社交网络账号失败 |
202303 | Failed to update user information | api.User.setting | 更新用户信息失败 |
202304 | The old and new passwords are the same | api.User.setting | 新旧密码相同 |
202305 | New and confirmed passwords are not the same | api.User.setting | 新密码与确认密码不一致 |
url: /api/User/snsreg
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
username | string | true | 用户名 |
password | string | true | 密码 |
confirm | string | true | 确认密码 |
string | true | 邮箱 | |
type | string | true | reg/log |
{"error_code":0,"api_uri":"URI","login_token":"TOKEN","uid":UID}
url: /api/User/validateUniqueUsername
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
response_type | string | true | json OR code |
username | string | true | 用户名 |
{"error_code":0,"api_uri":"URI"}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
202002 | The username already registered | api.User.common | 用户名已存在 |
url: /api/User/validateUniqueEmail
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
string | true |
{"error_code":0,"api_uri":"URI"}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
202003 | The email already exists | api.User.common |
url: /api/User/sendcode
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
medium | string | false | 邮箱或手机号码 |
{"error_code":0,"api_uri":"URI"}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
202007 | The sending interval of verification code is %d seconds | api.User.common | 发送间隔为%d秒 |
202101 | Not logged in yet | api.User.login | 尚未登录 |
url: /api/User/validateCommunicationCode
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
code | int | true | 邮箱或手机验证码 |
medium | string | false | 邮箱或手机号码 |
{"error_code":0,"api_uri":"URI"}
If id=null list all the messages else read the message of the id
url: /api/User/message
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
id | int | false | 消息id |
{"error_code":0,"api_uri":"URI","data":"MESSAGE"}
url: /api/User/avatar
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
access_token | string | true | |
uid/username | int/string | true | uid OR usernmae |
size | int | true | 420: 420 * 560, 413: 413 * 579 |
{"error_code":0,"api_uri":"URI","avatar":"URL",,"width":W,"height":H,"version":V}
or
IMAGE
###### Error codes
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
202401 | The ID have no avatars | api.User.avatar | 该ID无头像 |
url: /api/User/uid
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
access_token | string | true | |
username | string | true |
{"error_code":0,"api_uri":"URI","uid":"UID"}
url: /api/User/avatarUpload
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
access_token | string | true | |
uid/username | int/string | true | uid OR usernmae |
avatar | file | true | 头像 |
{"error_code":0,"api_uri":"URI","message":"successful"}
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
100004 | Validation failed | system.common | 上传验证失败(原因) |
202301 | Fail to upload avatar | api.User.setting | 上传头像失败 |
The image format must be jpg or png (图片格式应该是jpg或png); File requirements are image types (文件类型应该是图片); The image background should be white (图像背景应该是白色); The file size should be between 40KB and 2MB (文件应该在40KB到2MB之间); The image width should between 412 pixels and 600 pixels (图像宽在:412 - 600像素之间); The image height should between 578 pixels and 800 pixels (图像高在:412 - 600像素之间);
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
203101 | No to-do events | api.Calendar.events | 无代办事宜 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
203201 | Fail to add a event | api.Calendar.add | 添加代办事项失败 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
203301 | Event id not specified | api.Calendar.update | 未指定代办事项id |
url: /api/User/friends
method: POST
url: /api/User/friendmake
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
fid | int | true | 朋友id |
url: /api/User/frienddel
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
fid | int | true | 朋友id |
url: /api/User/friendsrecommend
method: POST
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
204101 | No friends found | api.Intercourse.friend | |
204102 | Failed to make friends | api.Intercourse.friend | |
204103 | Failed to delete a friend | api.Intercourse.friend | |
204104 | Failed to notify your friend | api.Intercourse.friend |
url: /api/Image/captcha
method: GET/POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
type | string | false | png/jpg/bmp |
id | string | false | Captcha id for different scenarios |
url: /api/Image/captchaVerify
method: GET/POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
captcha | string | false | 验证码 |
id | string | false | 不同id下的验证码 |
flush | string | false | 默认值为yes,表示刷新后不重置,用于ajax接口 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
200002 | Captcha verification failed | api.common | 验证失败 |
url: /api/Image/chaos
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
image | string(base64) | true | 图像的base64编码 |
password | int(6) | false | 密码 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
206001 | Invalid input image | api.image.common | 图像无效 |
url: /api/Image/order
method: POST
Parameter | Type | REQUIRED | Remarks |
---|---|---|---|
image | string(base64) | true | 图像的base64编码 |
password | int(6) | true | 密码 |
error_code (int) | Message(string) | URI | Remarks |
---|---|---|---|
206001 | Invalid input image | api.image.common | 图像无效 |