Cloudsight API无法识别这些参数

Cloudsight API无法识别这些参数,cloudsight,Cloudsight,向cloudsight api发送请求时出现以下错误 {“error”:{“image”:[“必须至少创建一个image或remote_image_url。” 设置“]} 你能告诉我丢失了什么吗 代码片段: var xhr = new XMLHttpRequest(); var url = "http://api.cloudsightapi.com/image_requests"; xhr.open("POST", url, true); xhr.setRequestHeader('Conte

向cloudsight api发送请求时出现以下错误

{“error”:{“image”:[“必须至少创建一个image或remote_image_url。” 设置“]}

你能告诉我丢失了什么吗

代码片段:

var xhr = new XMLHttpRequest();
var url = "http://api.cloudsightapi.com/image_requests";

xhr.open("POST", url, true);
xhr.setRequestHeader('Content-type', 'application/json');
xhr.setRequestHeader('authorization', 'CloudSight <MY_API_KEY>');
xhr.setRequestHeader('cache-control', 'no-cache');

xhr.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        var myArr = JSON.parse(this.responseText);
        alert(http.responseText);
    }
};

xhr.send(JSON.stringify({"remote_image_url":"http://englishbookgeorgia.com/blogebg/wp-content/uploads/2015/08/husky.jpg" ,"locale":"en_US"}));
var xhr=new-XMLHttpRequest();
变量url=”http://api.cloudsightapi.com/image_requests";
xhr.open(“POST”,url,true);
setRequestHeader('Content-type','application/json');
setRequestHeader('authorization','CloudSight');
setRequestHeader('cache-control','no-cache');
xhr.onreadystatechange=函数(){
if(this.readyState==4&&this.status==200){
var myArr=JSON.parse(this.responseText);
警报(http.responseText);
}
};
send(JSON.stringify({“远程图像url”:”http://englishbookgeorgia.com/blogebg/wp-content/uploads/2015/08/husky.jpg“,”区域设置“:”en_US“}”);

您将希望使用此处记录的v1 api:

下面是使用v1api更正的块

var xhr = new XMLHttpRequest();
var url = "http://api.cloudsightapi.com/v1/images";

xhr.open("POST", url, true);
xhr.setRequestHeader('Content-type', 'application/json');
xhr.setRequestHeader('authorization', 'CloudSight <Your API Key>');
xhr.setRequestHeader('cache-control', 'no-cache');

xhr.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        var myArr = JSON.parse(this.responseText);
        alert(this.responseText);
    }
};

xhr.send(JSON.stringify({"remote_image_url":"http://englishbookgeorgia.com/blogebg/wp-content/uploads/2015/08/husky.jpg" ,"locale":"en_US"}));

这就是产生错误的原因。

我也尝试过传递图像块中的参数,正如您所提到的,它仍然抛出相同的错误send(JSON.stringify({“image”:{“remote_image_url”:“}}”)`试试
http://api.cloudsight.ai/v1/images
。还有,当你说它不起作用时,你犯了什么错误?
{
  image: {
    remote_image_url: "example",
    locale: "en_US"
  }
}