Is it possiable to use own domain and host with the Bolt?


#1

Hello . I am new to Bolt . I wanna make a home automation project with Bolt . Is it possiable to use own domain and host with the Bolt ? If yes show me the steps .


#2

Hi @REMO,
Bolt cloud offers bolt cloud API, Using Bolt cloud API you can write your code on your own server to control or monitor your devices.
You can find the documentation here https://cloud.boltiot.com/docs

If you are building a website in PHP,
Then you can refer this code

<?php

$request = new HttpRequest();
$request->setUrl('http://cloud.boltiot.com/remote/abc061df-bef5-4881-b54e-a73099e3f66b/digitalWrite');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData(array(
  'pin' => '0',
  'state' => 'LOW',
  'deviceName' => 'BOLT3461212'
));

$request->setHeaders(array(
  'cache-control' => 'no-cache'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
} 

or if you building a website in nodejs then you can refer this code.

var http = require("http");

var options = {
  "method": "GET",
  "hostname": "cloud.boltiot.com",
  "port": null,
  "path": "/remote/abc061df-bef5-4881-b54e-a73099e3f66b/digitalWrite?pin=0&state=LOW&deviceName=BOLT3461212",
  "headers": {
    "cache-control": "no-cache"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

Do let me know in case you need further assistance.


#3

Thanks a lot @rahul.singh . I enable the the API and generate the API code and use the code https://cloud.boltiot.com/remote/#############/digitalWrite?pin=0&state=HIGH&deviceName=BOLT1#####02
to use the cloud of Bolt and works fine .


#4