我正在编写 HTML5/Backbone/Phonegap 应用程序Github 仓库 https://github.com/marfnk/sosmobileclient/它使用 52n 的 SensorObservationService REST API(v1 API 文档 http://sensorweb.demo.52north.org/sensorwebclient-webapp-stable/api-doc/index.html#timeseries)。
每个 GET 请求都工作正常 - 但现在我想下载 POST 请求后生成的图片。
但服务器响应状态为 400:
statusCode":400,"hints":["Check the message which has been sent to the server. Probably it is not valid."],"reason":"Bad Request","developerMessage":"Could not read JSON
...
这是我的 AJAX 调用:
var body = {
"base64":true,
"legend":false,
"timespan":"2013-10-30T00:00:00Z/2013-10-30T23:59:59Z",
"width":482,
"height":568,
"language":"en",
"grid":false,
"styleOptions": {
"ts_32e1174948e46f2e46fe597eb40b3557": {
"chartType": "line",
"properties": {
"color": "#b45e87",
"lineType":"solid",
"width":1
}
}
}
};
$.support.cors = true;
this.xhr = $.ajax({
crossDomain: true,
type: "POST",
url:"http://sensorweb.demo.52north.org/sensorwebclient-webapp-stable/api/v1/timeseries/getData",
processData: false,
dataType: "json",
accept: "application/json",
contentType: "application/json; charset=utf-8",
data: body
}).done(function(data) {
}).fail(function(xhr, textStatus) {
}).always(function() {
});
这是我的fiddle http://jsfiddle.net/mD2Pn/5/- 如果我尝试使用 POSTMAN 进行相同的 POST 调用,服务器会按照他应该做的那样进行操作。
RESTClient-Screenshot
我的通话有什么问题吗?