{"error_code":222200,"error_msg":"request body should be json format","log_id":500175451510,"timestamp":1531846106,"cached":0,"result":null}
$.ajax({
url: 'https://aip.baidubce.com/rest/2.0/face/v3/detect?access_token=我的token',
type:'post',
dataType: 'jsonp',
async : false,
data: '[{"image":"http://www.bosidata.com/resource/images/201605/201605310947574t5l_o.png","image_type":"URL"},{"image":"http://www.bosidata.com/resource/images/201605/201605310947574t5l_o.png","image_type":"URL"}]',
contentType:"application/json",
success: function(data) {
// alert("接到access_token");
// console.log(data);
if(data.error_code == 0){
if(data.result.face_num == 1)
{
console.log( JSON.stringify(data));
alert("接到access_token");
// WebcamVideo.set(player,Webcam);
Webcam.setAttribute("hidden",true);
}
}
},
error:function(data) {
alert("报错access_token");
},
});
敢问楼主,你的这个 222200错误码的问题解决了没有,如已解决,可否告知解决方案?
我也再测试人脸接口,也遇到了这个问题:
{"error_code":222200,"error_msg":"request body should be json format","log_id":8994355579949,"timestamp":1532572591,"cached":0,"result":null}
报错确实是222200这个错误码,但是api错误码表里确实没有这个错误码
没有这个错误呀。你是不是给错了
$.ajax({
"method": "POST",
"url": "https://aip.baidubce.com/rest/2.0/face/v3/match?access_token= 我的ToKen",
"headers": {
"Content_Type": "application/json"
},
"xhrFields": {
"withCredentials": true
},
"data": [
{
"image": "http://www.bosidata.com/resource/images/201605/201605310947574t5l_o.png",
"image_type": "URL"
},
{
"image": "http://www.bosidata.com/resource/images/201605/201605310947574t5l_o.png",
"image_type": "URL"
}
]
});
用测试HTTP协议链接 能获取到数据 但有记录报错222200
$.ajax({
"method": "POST",
"url": "https://aip.baidubce.com/rest/2.0/face/v3/match?access_token= 我的ToKen",
"headers": {
"Content_Type": "application/json"
},
"xhrFields": {
"withCredentials": true
},
"data": [
{
"image": "http://www.bosidata.com/resource/images/201605/201605310947574t5l_o.png",
"image_type": "URL"
},
{
"image": "http://www.bosidata.com/resource/images/201605/201605310947574t5l_o.png",
"image_type": "URL"
}
]
});
用测试HTTP协议链接 能获取到数据 但有记录报错222200
接口貌似不支持跨域把
你可以考虑用一下axios那个插件 貌似有开发者用这个解决了。
接口只支持post亲。
jsonp是get发送。