CaμsAPI 接口定义
1. 校内人员信息验证
功能介绍:
开发者通过此 API 验证校内人员身份,返回人员基本信息。
验证是 API 为校内人员提供课业数据服务的前提
接口: /users/register
请求类型:POST
请求参数:
{
"apikey": "API Key",
"apisecret": "API Secret Key",
"username": "Valid username(e.g. 2014000000 or abc14)",
"password": "Right-password-of-this-id"
}
参数说明:
字段 | 含义 | 备注 |
---|---|---|
apikey | API授予开发者的账户编号 | 64位随机字符串 |
apisecret | API授予开发者的账户密码 | 64位随机字符串 |
username | 校内人员在校园网中的账户名 | 编号/非编号方式均可 |
password | 校内人员在校园网中的账户密码 |
返回结果:
- 校内人员信息验证成功
Response 200
{
"message": "Success",
"username": "Request username",
"existed": true/false,
"information": {
"studentnumber": "Stundent number",
"department": "Department",
"position": "undergraduate/master/doctor/teacher",
"email": "Email",
"realname": "Real name"
}
}
参数说明:
字段 | 含义 | 备注 |
---|---|---|
existed | 表明学生信息是否被重复验证,true为重复验证 | true 或者 false |
参数示例:
Response 200
{
"message": "Success",
"username": "mzj14",
"existed": false,
"information": {
"studentnumber": "2014013408",
"department": "软件学院",
"position": "undergraduate",
"email": "[email protected]"
"realname": "马子俊",
}
}
- 校内人员信息验证失败(用户名和密码非法)
Response 400
{
"message": "Failure",
"username": "Request username",
"reason": "Auth failed"
}
- 校内人员信息验证失败(POST数据字段不完整)
Response 400
{
"message": "Failure",
"reason": "Missing Arguments"
}
注:开发者请求 API 数据失败的原因是多方面的。上述列出的只是一些典型的原因,其他非典型的原因还请具体考察 reason
字段的返回内容。