提交信息模板实名认证,提交实名认证时需要上传采用Base64编码的实名认证资料图片,并要求原图片为jpg或者bmp格式,原图片大小限制为55K-1M。该接口必须采用POST方式调用,否则调用将会失败,使用SDK调用时,请设置request对象的method参数为POST。
公共请求参数,详见公共参数
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
Action | String | 是 | 操作接口名,系统规定参数,取值:SaveContactTemplateCredential |
ContactTemplateId | Long | 是 | 信息模板编号 |
CredentialNo | String | 是 | 实名认证资料证件号码,如:身份证号码、统一社会信用代码 |
Credential | String | 是 | 使用Base64编码的实名认证资料图片。要求图片为jpg或者bmp格式,图片大小限制为55K-1M。 |
名称 | 类型 | 描述 |
---|---|---|
RequestId | String | 唯一请求识别码 |
错误代码 | 描述 | HTTP状态码 | 语义 |
---|---|---|---|
ParameterIllegal | Parameter illegal. | 400 | 参数错误 |
NetworkIOError | Network IO Error. | 400 | 网络IO异常 |
FileDataError | File data error. | 400 | 上传的文件数据错误 |
FileFormatNotSupported | The file format is not supported. | 400 | 上传的文件格式不支持 |
FileSizeLessThanMinLimit | The file size is smaller than the minimum limit. | 400 | 上传的文件大小小于最小值限制 |
FileSizeGreaterThanMaxLimit | The file size exceeds the maximum limit. | 400 | 上传的文件大小大于最大值限制 |
ContactTemplateNotExist | Contacts template does not exist. | 400 | 联系人模板不存在 |
ContactTemplateAudited | The current information template has a status of real-name authentication complete or under review, so you cannot submit real-name authentication materials. | 400 | 当前信息模板状态为已实名认证或审核中,不允许提交实名认证资料 |
ContactTemplateUpdateFailed | Failed to save template information. | 400 | 模板资料保存失败 |
请求是由POST的方式调用,以下将以java SDK为示例:
import org.apache.commons.codec.binary.Base64;
import com.aliyuncs.domain.model.v20160511.SaveContactTemplateCredentialRequest;
import com.aliyuncs.domain.model.v20160511.SaveContactTemplateCredentialResponse;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.IClientProfile;
import com.aliyuncs.DefaultAcsClient;
public class SaveContactTemplateCredentialDemo {
private static IAcsClient client = null;
//初始化client
static {
String regionId = “cn-hangzhou”; //必填固定值,必须为“cn-hanghou”
String accessKeyId = “”; // your accessKey
String accessKeySecret = “”;// your accessSecret
IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
client = new DefaultAcsClient(profile);
}
public static void main(String[] args) {
//请自行读取文件获取图片的字节数组
byte[] img = null;
//将图片进行Base64编码
String base64Img = Base64.encodeBase64String(img);
//初始化请求
SaveContactTemplateCredentialRequest request = new SaveContactTemplateCredentialRequest();
//指定请求方法
request.setMethod(MethodType.POST);
request.setCredentialNo(“000000000000000000”);
request.setContactTemplateId(000000L);
request.setCredential(base64Img);
//发起api调用并解析结果
try {
//调用失败会抛出异常
SaveContactTemplateCredentialResponse response = client.getAcsResponse(request);
System.out.println(response.getRequestId())
} catch (ServerException e) {
e.printStackTrace();
} catch (ClientException e) {
e.printStackTrace();
}
}
}
###返回示例
XML示例
<?xml version=’1.0’ encoding=’UTF-8’?>
<SaveContactTemplateCredentialResponse>
<RequestId>51D584A2-0CCD-4336-AD7D-1AD4C67B5545</RequestId>
</SaveContactTemplateCredentialResponse>
JSON示例
{
“RequestId”: “51D584A2-0CCD-4336-AD7D-1AD4C67B5545”
}
在文档使用中是否遇到以下问题
更多建议
匿名提交