hey guys ! can anyone help me in sending data from android application to bolt cloud!?
Hi @aheesh13,
Bolt Cloud offer Bolt Cloud API and if you have API, you can using any programming language to trigger the API.
For example:
PHP has many requesting library and one such library is https://github.com/pear/HTTP_Request2 and you can use the below code snippet to trigger the Bolt Cloud API.
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://cloud.boltiot.com/remote/1cdfabea-306f-413f-a84b-552938aa8c5d/digitalWrite?pin=2&state=LOW&deviceName=BO7488206');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
Similarly in java there is one such packages called Okhttp https://www.vogella.com/tutorials/JavaLibrary-OkHttp/article.html, You can use that library to trigger the Bolt Cloud API.
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://cloud.boltiot.com/remote/1cdfabea-306f-413f-a84b-552938aa8c5d/digitalWrite?pin=2&state=LOW&deviceName=BO7488206")
.method("GET", null)
.build();
Response response = client.newCall(request).execute();
Please look into the above code and do let me now in case you need any other other information.