Skip to content

MQTT Credentials

GET
/users/id/getMqttCredentials

Retrieves a users MQTT Credentials if set, for legacy use in connecting to MQTT.

Parameters

Path Parameters

id*

user id

Typestring
Required
formatJSON

Responses

Request was successful
application/json
JSON
{
"clientId": "string",
"username": "string",
"password": "string"
}

Samples

cURL
curl -X GET \
'https://api.lightbug.cloud/api/users/id/getMqttCredentials' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://api.lightbug.cloud/api/users/id/getMqttCredentials', {headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://api.lightbug.cloud/api/users/id/getMqttCredentials';
$method = 'GET';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://api.lightbug.cloud/api/users/id/getMqttCredentials'

headers = {
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)
print(response.json())