Lelylan
IoTLelylan API Documentation
The Lelylan API is a RESTful API that allows developers to programmatically interact with Lelylan's Internet of Things (IoT) cloud platform. This documentation provides a comprehensive list of endpoints, parameters, and responses available through the API.
Base URL
All API endpoints described here have the following base URL: https://api.lelylan.com
Authentication
All requests to the Lelylan API must be authenticated. To authenticate your requests, you'll need an access token. You can create an access token by visiting the Lelylan Developer Portal and creating an application.
Once you have an access token, include it as an Authorization
header in all of your API requests. For example:
const axios = require('axios');
const accessToken = 'YOUR_ACCESS_TOKEN';
const headers = {
Authorization: `Bearer ${accessToken}`,
};
axios.get('https://api.lelylan.com/things', {
headers,
});
Endpoints
Things
List all Things
Returns a list of all connected things.
axios.get('https://api.lelylan.com/things', { headers });
View a Thing
Returns a specific thing.
const thingId = 'THING_ID';
axios.get(`https://api.lelylan.com/things/${thingId}`, { headers });
Create a Thing
Creates a new thing.
const data = {
name: 'NAME',
description: 'DESCRIPTION',
type: {
id: 'TYPE_ID',
},
owner: {
id: 'OWNER_ID',
},
};
axios.post('https://api.lelylan.com/things', data, { headers });
Update a Thing
Updates an existing thing.
const thingId = 'THING_ID';
const data = {
name: 'NEW_NAME',
description: 'NEW_DESCRIPTION',
};
axios.put(`https://api.lelylan.com/things/${thingId}`, data, { headers });
Delete a Thing
Deletes an existing thing.
const thingId = 'THING_ID';
axios.delete(`https://api.lelylan.com/things/${thingId}`, { headers });
Devices
List all Devices
Returns a list of all connected devices.
axios.get('https://api.lelylan.com/devices', { headers });
View a Device
Returns a specific device.
const deviceId = 'DEVICE_ID';
axios.get(`https://api.lelylan.com/devices/${deviceId}`, { headers });
Create a Device
Creates a new device.
const data = {
name: 'NAME',
description: 'DESCRIPTION',
type: {
id: 'TYPE_ID',
},
owner: {
id: 'OWNER_ID',
},
};
axios.post('https://api.lelylan.com/devices', data, { headers });
Update a Device
Updates an existing device.
const deviceId = 'DEVICE_ID';
const data = {
name: 'NEW_NAME',
description: 'NEW_DESCRIPTION',
};
axios.put(`https://api.lelylan.com/devices/${deviceId}`, data, { headers });
Delete a Device
Deletes an existing device.
const deviceId = 'DEVICE_ID';
axios.delete(`https://api.lelylan.com/devices/${deviceId}`, { headers });
Conclusion
The Lelylan API is a powerful tool for building IoT applications, and this documentation provides a comprehensive and easy-to-use guide to getting started. If you have any questions or feedback, please don't hesitate to reach out to us at support@lelylan.com. Happy coding!