ajax
tuitaituita 发布于2018-07 浏览:1987 回复:6
0
收藏
快速回复
最后编辑于2018-07

{"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");
},
});

 

 

收藏
点赞
0
个赞
共6条回复 最后由302963445回复于2018-07
#7302963445回复于2018-07

敢问楼主,你的这个 222200错误码的问题解决了没有,如已解决,可否告知解决方案?

0
#6302963445回复于2018-07

我也再测试人脸接口,也遇到了这个问题:

{"error_code":222200,"error_msg":"request body should be json format","log_id":8994355579949,"timestamp":1532572591,"cached":0,"result":null}

报错确实是222200这个错误码,但是api错误码表里确实没有这个错误码

 

0
#5用户已被禁言回复于2018-07
#4 tuitaituita回复
$.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
展开

没有这个错误呀。你是不是给错了

1
#4tuitaituita回复于2018-07
#2 用户已被禁言回复
接口貌似不支持跨域把 你可以考虑用一下axios那个插件 貌似有开发者用这个解决了。 接口只支持post亲。 jsonp是get发送。
展开

$.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

0
#3tuitaituita回复于2018-07

$.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

0
#2用户已被禁言回复于2018-07

接口貌似不支持跨域把

你可以考虑用一下axios那个插件 貌似有开发者用这个解决了。

接口只支持post亲。

jsonp是get发送。

1
TOP
切换版块