I'm writing an HTML5/Backbone/Phonegap app Github Repo which uses the SensorObservationService REST API by 52n (v1 API Docs). Every GET-Request works fine - but now I want to download a picture that is generated after a POST request.
But the server is responding with status 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
...
This is my AJAX-Call:
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() {
});
Here is my fiddle - If I try the same POST call with POSTMAN the server does as he should.
RESTClient-Screenshot
What is wrong with my call?