文档中心 > 入门指南

学段数据API接口

一、概述

获取满分学堂学段说明

二、如何使用

满分学堂应用创建后,会自动生成「我的账户」appid,appkey,然后将所需参数拼装成http请求,即可调用。支付php,java等。

三、接口说明

满分开放接口文档pdf在线预览

1. 接口描述

url https://open.canpoint.net/openapi/manfenbase/get_type
功能描述 获取类型数据接口
返回格式 Json,utf8
HTTP请求方式 get

2. 请求描述

2.1 请求参数(header)

参数名 类型 必填 参数位置 描述 默认值
appid string header 账户APPID
appkey string header 账户APPKEY

2.2 输入参数(urlParam)

2.3 输出参数

参数名 类型 必填 描述 默认值
result_code int 返回信息 0
msg string 返回描述
data array() 返回值
data['name'] srting 类型名称
data['code'] int 类型ID

3.请求示例

3.1 请求示例

3.1.1 curl示例

curl --get --include 'https://open.canpoint.net/openapi/manfenbase/get_type' -H 'appid:您自己的appid \n appkey:您自己的appkey'

3.1.2 php示例

<?php
$ch = curl_init();
$url = 'https://open.canpoint.net/openapi/manfenbase/get_type';
$header = array(
'appid':您自己的appid',
'appkey: 您自己的appkey'
);
// 添加apikey到header
curl_setopt($ch, CURLOPT_HTTPHEADER , $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// 执行HTTP请求
curl_setopt($ch , CURLOPT_URL , $url);
$res = curl_exec($ch);

var_dump(json_decode($res));
?>

3.1.3 python示例

# -*- coding: utf-8 -*-
import sys, urllib, urllib2, json

url = 'https://open.canpoint.net/openapi/manfenbase/get_type'

req = urllib2.Request(url)

req.add_header("appid", "您自己的appid")
req.add_header("appkey", "您自己的appkey")

resp = urllib2.urlopen(req)
content = resp.read()
if(content):
print(content)

3.1.4 java示例

String httpUrl = "https://open.canpoint.net/openapi/manfenbase/get_type";
String httpArg = "";
String jsonResult = request(httpUrl, httpArg);
System.out.println(jsonResult);

/**
* @param urlAll
* :请求接口
* @param httpArg
* :参数
* @return 返回结果
*/
public static String request(String httpUrl, String httpArg) {
BufferedReader reader = null;
String result = null;
StringBuffer sbf = new StringBuffer();
httpUrl = httpUrl + "?" + httpArg;

try {
URL url = new URL(httpUrl);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setRequestMethod("GET");
// 填入apikey到HTTP header
connection.setRequestProperty("appid", "您自己的appid");
connection.setRequestProperty("appkey", "您自己的appkey");
connection.connect();
InputStream is = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String strRead = null;
while ((strRead = reader.readLine()) != null) {
sbf.append(strRead);
sbf.append("rn");
} reader.close();
result = sbf.toString();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}

3.1.5 C#示例

string url = "https://open.canpoint.net/openapi/manfenbase/get_type";
string param = "";
string result = request(url,param);

/// /// 发送HTTP请求
///

/// 请求的URL
/// 请求的参数
/// 请求结果
public static string request(string url, string param)
{
string strURL = url + '?' + param;
System.Net.HttpWebRequest request;
request = (System.Net.HttpWebRequest)WebRequest.Create(strURL);
request.Method = "GET";
// 添加header
request.Headers.Add("appid", "您自己的appid");
request.Headers.Add("appkey", "您自己的appkey");
System.Net.HttpWebResponse response;
response = (System.Net.HttpWebResponse)request.GetResponse();
System.IO.Stream s;
s = response.GetResponseStream();
string StrDate = "";
string strValue = "";
StreamReader Reader = new StreamReader(s, Encoding.UTF8);
while ((StrDate = Reader.ReadLine()) != null)
{
strValue += StrDate + "rn";
}
return strValue;
}

3.2 返回值

{
"result_code": 0,
"msg": "",
"data": [
{
"name": "知识点微课",
"code": "1",
},
{
"name": "同步精讲",
"code": "2",
}
]
}

4. 错误参照码

错误码 错误码返回说明
0 成功返回
1010 商户appid错误
1011 商户key值错误
2011 点播失败
2013 参数不正确
2014 商户appid或key值错误
2015 您购买的服务已到期
2016 您购买的服务未开始