Page 2 of 2

Re: HTTP call from evothings client

Posted: 19:00, 27 Nov 2015
by JimB
I have followed that, but must be missing something. But it appears not to be an Evothings problem, so there's that.

Re: HTTP call from evothings client

Posted: 09:12, 29 Nov 2015
by JimB
The CORS stuff is now working (<AllowedHeader>Content-*</AllowedHeader> was the missing line, apparently) and my Evothings app can access the JSON file in terms of linking to it and displaying it, but it isn't reading it in the code. Working on it.

And running the HTTPGET Cordova I get
LOG: {"status":500,"error":"There was an error with the request"}

Re: HTTP call from evothings client

Posted: 09:58, 29 Nov 2015
by JimB
And FYI
$(document).ready(function() {

//after button is clicked we download the data
$('.button').click(function(){
$.getJSON("http://giveandgo.nz.s3-website-ap-southeast-2.amazonaws.com/location.json", function(result){
$.each(result.locationlist.location, function(i, field){
//alert(field.name );
$('#results select').append('<option value=' + field.locationID + '>' + field.name + '</option>');
});
});
//start ajax request
});
});

Works on a webpage but not Evothings.

Re: HTTP call from evothings client

Posted: 20:39, 21 Dec 2015
by alex
Hi!

I think it's a matter of mixing protocols. Your page is served to the Viewer by https from the server, while the resource you're picking up is http in the JSON call. That would result in a protocol violation. You could try using https://giveandgo.nz.s3-website-ap-sout ... ation.json
instead, given that the site has a valid certificate.

best

Alex

Re: HTTP call from evothings client

Posted: 04:25, 28 Dec 2015
by JimB
Got it going by using the AWS API Gateway. All running lovely now. Thanks for the support!

Re: HTTP call from evothings client

Posted: 10:00, 28 Dec 2015
by gokr
Great to hear you got it working!

We are about to post much more about the intricacies around CORS and http vs https - as mentioned here the app is served from our cloud over https so you can not access any http resources from the app - you must use https (with valid certs!) and if you use web sockets you must also use secure websockets (again with valid real certs). This can be a bit of a hassle when developing.

The latest viewer that we are in the process of publishing will also have the ability to do http requests via a Cordoba plugin (thus sidestepping this issue) but that of course needs to be done with specific code.

regards, Göran

PS. We are on http://gitter.im/evothings/evothings also, and we try to always be available for questions!