Open API
来自成绩云帮助中心
登录
URL: https://[site_url]/?q=school-users/api/login
POST参数:id - 学号, pass - 密码
返回:JSON结构字符串,其中uid和token属性将用于其它接口身份验证。
注意:密码错误如果超过10次,则该账号6小时内不能通过此API登录。
PHP示例代码:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://chengjiyun.com/demo/?q=school-users/api/login"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "id=20120101&pass=123"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $output = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code == 200 && $output) { $result = json_decode($output); var_dump($result); } else { echo "http_code: $http_code\n"; echo curl_error($ch); } curl_close ($ch);
示例结果:
object(stdClass)[202] public 'uid' => string '90' (length=2) public 'token' => string '7338c0954acba04b7dd5b8b74dfe2130' (length=32) public 'msg' => string 'login succeed' (length=13)
获取学生考试列表
URL: http://[site_url]/?q=transcripts/api/get-student-exams/[uid]/[token]
其中,uid即token的值应该在登录的接口中获取。
返回:JSON结构字符串,示例结果如下
{"exams": [ {"tid":"58", "name":"2012-2013\u5b66\u5e74\u5ea6\u4e0b\u5b66\u671f\u9ad8\u4e00\u671f\u4e2d\u8003\u8bd5", "short_name":"\u9ad8\u4e00\u4e0b\u671f\u4e2d", "exam_time":"1367078400", "update_time":"1367333382" }, {"tid":"79", "name":"2012\u7ea7\u9ad8\u4e00\u4e0b\u5b66\u671f\u671f\u672b\u8003\u8bd5", "short_name":"\u9ad8\u4e00\u671f\u672b", "exam_time":"1373472000", "update_time":"1377961856" } ] }