《阿里云市场接入大鱼服务api文档》由会员分享,可在线阅读,更多相关《阿里云市场接入大鱼服务api文档(13页珍藏版)》请在金锄头文库上搜索。
1、 阿里云大鱼服务 API 使用文档 目录 1. 简介 . 1 2. 适用对象 . 1 3. 安全 import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.methods.RequestBuilder; import org.apache.http.i
2、mpl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; public class SendSmsTest public static void main(String args) CloseableHttpClient httpClient = HttpClients.createDefault(); try / 请求地址 HttpUriRequest httpGet = RequestBuilder .get
3、(“https:/ .addHeader(“X-Ca-Key“, “appKey“) 阿里云大鱼服务 API 使用文档 5 .addHeader(“X-Ca-Secret“, “appSecret“) .addParameter(“rec_num“,“13000000000“) .addParameter(“sms_template_code“, “SMS_100000“) .addParameter(“sms_free_sign_name“, “登录验证“) .addParameter(“sms_type“, “normal“) .addParameter(“extend“, “1234“)
4、 .addParameter(“sms_param“, “code:1234,product:alidayu“) .build(); / TODO 设置请求超时时间 / 处理请求结果 ResponseHandler responseHandler = new ResponseHandler() Override public String handleResponse(final HttpResponse response) throws IOException int status = response.getStatusLine().getStatusCode(); System.out.
5、println(status); HttpEntity entity = response.getEntity(); return entity != null ? EntityUtils.toString(entity) : null; ; / 发起API调用 String responseBody = httpClient.execute(httpGet, responseHandler); System.out.println(responseBody); catch (Exception e) e.printStackTrace(); finally try httpClient.cl
6、ose(); catch (IOException e) e.printStackTrace(); PHPPHP: 待更新 阿里云大鱼服务 API 使用文档 6 PYTHONPYTHON # coding=utf-8 import urllib2 url = “https:/ + “?rec_num=13000000000“ + “ import org.apache.http.HttpResponse; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpUriReq
7、uest; import org.apache.http.client.methods.RequestBuilder; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import java.io.IOException; public class QuerySmsDetailTest public static void main(String args
8、) CloseableHttpClient httpClient = HttpClients.createDefault(); try / 请求地址 HttpUriRequest httpGet = RequestBuilder .get(“https:/ .addHeader(“X-Ca-Key“, “appKey“) .addHeader(“X-Ca-Secret“, “appSecret“) .addParameter(“rec_num“,“13000000000“) .addParameter(“query_date“, “20160106“) .addParameter(“curre
9、nt_page“, “1“) .addParameter(“page_size“, “10“) .build(); / TODO 设置请求超时时间 / 处理请求结果 ResponseHandler responseHandler = new ResponseHandler() Override public String handleResponse(final HttpResponse response) throws IOException int status = response.getStatusLine().getStatusCode(); System.out.println(s
10、tatus); 阿里云大鱼服务 API 使用文档 10 HttpEntity entity = response.getEntity(); return entity != null ? EntityUtils.toString(entity) : null; ; / 发起API调用 String responseBody = httpClient.execute(httpGet, responseHandler); System.out.println(responseBody); catch (Exception ignore) finally try httpClient.close()
11、; catch (IOException ignore) PHPPHP 待更新 PYTHONPYTHON # coding=utf-8 import urllib2 url = “https:/ + “?rec_num=13000000000“ + “&query_date=20160107“ + “¤t_page=1“ + “&page_size=10“ req = urllib2.Request(url) req.add_header(“X-Ca-Key“, “appKey“) req.add_header(“X-Ca-Secret“, “appSecret“) resp =
12、urllib2.urlopen(req) content = resp.read() if content: print(content) 阿里云大鱼服务 API 使用文档 11 移动端移动端 请尽量不在移动端直接访问 API,通过开发者自己的服务端程序中转发起 API 调用。 返回示例返回示例 “current_page“:1, “page_size“:10, “total_count“:100, “total_page“:5, “values“: “extend“:“1234“, “rec_num“:“13000000000“, “result_code“:“000“, “sms_code
13、“:“SMS_10000“, “sms_content“:“短信内容“, “sms_receiver_time“:“2015-12-12 12:12:12“, “sms_send_time“:“2015-12-12 12:12:12“, “sms_status“:1 业务错误码对照表业务错误码对照表 错误码 错误描述 解决方案 50001 业务停机 登陆 进入管理中心充值 50009 手机号码格式非法 使用合法的手机号码 80001 查询时间非法 支持近 30 天记录查询。 80002 分页参数不合法 每页最大显示 50 条记录 99998 参数异常 检查参数合法性 50003 账户信息不存在 入驻阿里大鱼 阿里云大鱼服务 API 使用文档 12 TTSTTS 单呼单呼 APIAPI 稍后推出 语音单呼语音单呼 APIAPI 稍后推出 号码双呼号码双呼 APIAPI 稍后推出 语音发送记录查询语音发送记录查询 APIAPI 稍后推出