QueryInterSmsIsoInfo

更新时间: 2022-08-02 11:01:43

调用QueryInterSmsIsoInfo接口查询国际短信支持的国家码信息。

入参列表

参数名称

参数类型

必填与否

样例取值

参数说明

countryName

String

中国

查询指定国家的编码信息,如果不传会拉取目前支持的所有国家的国家编码信息列表。

出参列表

出参名称

出参类型

样例取值

参数说明

RequestId

String

8906582E-6722

请求ID。

Code

String

OK

状态码-返回OK代表请求成功,其他错误码详见错误码列表。

Message

String

请求成功

状态码的描述。

IsoSupportDTOs

Object

-

国家编码信息结构体,详见下面的样例程序。

技术对接步骤

步骤一:下载SDK工具包

SDK工具包中一共包含了2个类库,一个aliyun-java-sdk-core包,另外一个是alicom-dysms-api包,将这两个包执行mvn package命令或者mvn deploy命令打包出相应的jar包,添加到工程类库中依赖使用。

SDK&DEMO[下载地址]

步骤二:编写样例程序

        //可自助调整超时时间
        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
        //初始化acsClient,暂不支持region化
        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
        DefaultProfile.addEndpoint("ak-openapi-pop-cn-hangzhou", "cn-hangzhou", product, domain);
        IAcsClient acsClient = new DefaultAcsClient(profile);
        //组装请求对象
        QueryInterSmsIsoInfoRequest request = new QueryInterSmsIsoInfoRequest();
        //request.setCountryName("");
        //hint 此处可能会抛出异常,注意catch
        QueryInterSmsIsoInfoResponse queryInterSmsIsoInfoResponse = acsClient.getAcsResponse(request);
        if(queryInterSmsIsoInfoResponse.getCode() != null && queryInterSmsIsoInfoResponse.getCode().equals("OK")) {
            List<IsoSupportDTO> isoSupportDTOs = queryInterSmsIsoInfoResponse.getIsoSupportDTOs();
            for(IsoSupportDTO isoSupportDTO : isoSupportDTOs) {
                System.out.println(isoSupportDTO.getIsoCode());
                System.out.println(isoSupportDTO.getCountryCode());
                System.out.println(isoSupportDTO.getCountryName());
            }
        }
                        
阿里云首页 短信服务 相关技术圈