1. Overview
  2. API
  3. Sample Code

Sample Code

Python3

Python code for Digital Write API request

 
import requests
 
url = "https://cloud.boltiot.com/remote/1cdfabea-306f-413f-a84b-552938aa8c5d/digitalWrite"
 
querystring = {"pin":"2","state":"HIGH","deviceName":"BOLT8795377"}
 
headers = {
'Cache-Control': "no-cache"
}
 
response = requests.request("GET", url, headers=headers, params=querystring)
 
print(response.text)
 

PHP

PHP code for Digital Write API request

 
<?php
 
$request = new HttpRequest();
$request->setUrl('https://cloud.boltiot.com/remote/1cdfabea-306f-413f-a84b-552938aa8c5d/digitalWrite');
$request->setMethod(HTTP_METH_GET);
 
$request->setQueryData(array(
'pin' => '2',
'state' => 'LOW',
'deviceName' => 'BOLT8795377'
));
 
$request->setHeaders(array(
'Cache-Control' => 'no-cache'
));
 
try {
$response = $request->send();
 
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
 

Was this article helpful?
© 2025 Bolt IoT Documentation