sales@jiwebtech.com C-127, Phase 8, Industrial Area, Sector 72, Mohali, Punjab +919569227788

We use cookies, check our Privacy Policies.

Control IoT Devices

Use this endpoint to change the physical state of your connected hardware.


Authentication & Targeting

To successfully control a device, you must include your Access Token in the header and the target Device ID in the URL.

HEADER Authorization Bearer {YOUR_ACCESS_TOKEN}
Found in your User Profile settings.
URL Device ID https://app.jisecure.com/api/external/control/{DEVICE_ID}
The unique id number of the hardware (e.g., ED3E3E33FD33 ).

Implementation Code

Select your language to see how to format the request.

terminal
								# Define your credentials
ACCESS_TOKEN="xy78-your-secure-token-here"
DEVICE_ID="ios_5501"

# Send the request
curl -X POST \
  https://app.jisecure.com/api/external/control/$DEVICE_ID \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "hid": "relay1",
        "value": 1
      }'
							
main.py
								import requests

# 1. Setup Variables
access_token = "xy78-your-secure-token-here"
device_id = "ios_5501"
url = f"https://app.jisecure.com/api/external/control/{device_id}"

# 2. Prepare Headers & Payload
headers = {
    "Authorization": f"Bearer {access_token}",
    "Content-Type": "application/json"
}
payload = {
        "hid": "relay1",
        "value": 1
}

# 3. Send Request
try:
    response = requests.post(url, json=payload, headers=headers)
    print(response.status_code)
    print(response.json())
except Exception as e:
    print(f"Error: {e}")
							
controller.php
								<?php

// 1. Setup Variables
$accessToken = "xy78-your-secure-token-here";
$deviceId = "E33E3E3E3E3E";
$url = "https://app.jisecure.com/api/external/control/" . $deviceId ;

// 2. Initialize cURL
$ch = curl_init($url);

$payload = json_encode([
        "hid"=> "relay1",
        "value"=> 1
]);

// 3. Set Options (Headers & Payload)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer " . $accessToken,
    "Content-Type: application/json"
]);

// 4. Execute
$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
							
Program.cs
								using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        // 1. Setup Variables
        var accessToken = "xy78-your-secure-token-here";
        var deviceId = "ios_5501";
        var url = $"https://app.jisecure.com/api/external/control/{deviceId}";

        using (var client = new HttpClient())
        {
            // 2. Add Authorization Header
            client.DefaultRequestHeaders.Authorization = 
                new AuthenticationHeaderValue("Bearer", accessToken);

            // 3. Prepare Payload
            var jsonPayload = "{\"hid\":\"replay1\",\"value\":1}";
            var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");

            // 4. Send Request
            var response = await client.PostAsync(url, content);
            Console.WriteLine($"Status: {response.StatusCode}");
        }
    }
}
							
Menu