定向流量订购接口(OrderFlow)
定向流量整体流程及操作步骤
定向流量整体流程及操作步骤
参数说明
入参列表
出参列表
技术对接步骤
1:下载SDK工具包
SDK工具包中一共包含了2个类库,一个aliyun-java-sdk-core包,另外一个是alicom-dycdp-api包,将这两个包执行mvn package命令或者mvn deploy命令打包出相应的jar包,添加到工程类库中依赖使用。
SDK&DEMO[
下载地址]
2: 编写样例程序
- [backcolor=transparent] [backcolor=transparent]//设置访问超时时间
- [backcolor=transparent] [backcolor=transparent]System[backcolor=transparent].[backcolor=transparent]setProperty[backcolor=transparent]([backcolor=transparent]"sun.net.client.defaultConnectTimeout"[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]"10000"[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]System[backcolor=transparent].[backcolor=transparent]setProperty[backcolor=transparent]([backcolor=transparent]"sun.net.client.defaultReadTimeout"[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]"10000"[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]//云通信产品-流量服务API产品名称
- [backcolor=transparent] [backcolor=transparent]final[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] product [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"Dycdpapi"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]//云通信产品-流量服务API产品域名
- [backcolor=transparent] [backcolor=transparent]final[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] domain [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"dycdpapi.aliyuncs.com"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]//需要替换成你的AK信息
- [backcolor=transparent] [backcolor=transparent]final[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] accessKeyId [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"yourAccessKeyId"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]final[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] accessKeySecret [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"yourAccessKeySecret"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]//初始化acsClient
- [backcolor=transparent] [backcolor=transparent]IClientProfile[backcolor=transparent] profile [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]DefaultProfile[backcolor=transparent].[backcolor=transparent]getProfile[backcolor=transparent]([backcolor=transparent]"cn-hangzhou"[backcolor=transparent],[backcolor=transparent] accessKeyId[backcolor=transparent],[backcolor=transparent] accessKeySecret[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]DefaultProfile[backcolor=transparent].[backcolor=transparent]addEndpoint[backcolor=transparent]([backcolor=transparent]"cn-hangzhou"[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]"cn-hangzhou"[backcolor=transparent],[backcolor=transparent] product[backcolor=transparent],[backcolor=transparent] domain[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]IAcsClient[backcolor=transparent] acsClient [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]new[backcolor=transparent] [backcolor=transparent]DefaultAcsClient[backcolor=transparent]([backcolor=transparent]profile[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]//组装请求对象
- [backcolor=transparent] [backcolor=transparent]OrderFlowRequest[backcolor=transparent] request [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]new[backcolor=transparent] [backcolor=transparent]OrderFlowRequest[backcolor=transparent]();
- [backcolor=transparent] [backcolor=transparent]//订购的号码
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]setPhoneNumber[backcolor=transparent]([backcolor=transparent]"1300000000"[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]//订购的档位
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]setGrade[backcolor=transparent]([backcolor=transparent]"1"[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]//外部订单号
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]setTransferId[backcolor=transparent]([backcolor=transparent]"20170901123456001"[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]//请求失败这里会抛异常
- [backcolor=transparent] [backcolor=transparent]OrderFlowResponse[backcolor=transparent] acsResponse [backcolor=transparent]=[backcolor=transparent] acsClient[backcolor=transparent].[backcolor=transparent]getAcsResponse[backcolor=transparent]([backcolor=transparent]request[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]if[backcolor=transparent]([backcolor=transparent]acsResponse[backcolor=transparent].[backcolor=transparent]getCode[backcolor=transparent]()!=[backcolor=transparent] [backcolor=transparent]null[backcolor=transparent] [backcolor=transparent]&&[backcolor=transparent] acsResponse[backcolor=transparent].[backcolor=transparent]getCode[backcolor=transparent]().[backcolor=transparent]equals[backcolor=transparent]([backcolor=transparent]"OK"[backcolor=transparent]))[backcolor=transparent] [backcolor=transparent]{
- [backcolor=transparent] [backcolor=transparent]//请求成功
- [backcolor=transparent] [backcolor=transparent]}
错误码列表
[tr=rgb(239, 251, 255)][td]isv.PRODUCT_UN_SUBSCRIPT
未开通云通信产品的阿里云客户 |
isv.SYSTEM_ERROR | 接入层系统异常 |