Very pumped on the HTTP API you released. I got it up and running on my Photon and I have been doing some open-source development with it. See this repository.
However there is still a major flaw - the API does not allows CORS. To elaborate further⦠As far as Iām concerned (speaking from the standpoint of a someone developing an IoT product for end users) there are two ways to really leverage the HTTP Soft AP API you guys wrote:
1- Serve a web app (that runs in the browser) from our servers. Instruct the user to connect to the Photon generated Wifi AP, then have the web app make AJAX calls to the Photon, to get it connected to the WiFi and associated with a user (or any other model in our business logic).
e.g. using jQuery/AJAX
$.ajax({
url: āhttp://192.168.0.1/device-idā,
method: āgetā,
dataType: ājsonā,
success: function(response) {
console.log("It worked! Response: ");
console.log(response);
},
error : function (error, response) {
console.log(āDamn⦠no goodā¦ā);
}
});
However, since the web app was served from an origin other than 192.168.0.1 (i.e. it wasnāt served by the Photon), and the Photonās web server doesnāt stamp its responses with the header "Access-Control-Allow-Origin: * ", this will not work. The response is blocked by the browser. You can easily verify that.
2- Serve a separate (static) web page from the Photon specifically to connect to the WiFi (avoiding the CORS restrictions). This is what Iām currently working on and will share with the community (repo mentioned above). However, this puts a greater burden on the user, as they must somehow transcribe the device-id from the Photon, and send it to our severs via another form/process.
A third alternative is to use a native application (whether desktop or mobile) or Cordova pluggins (if building something hybrid) to make the HTTP calls to the Photon. However, at that point I could just use your existing SDKs or TCP protocols⦠so thereās no reason to use HTTP.
My point being, if you really want the HTTP API to be useful, you need to modify it on the Photon to allow CORS.