Delete Device
DELETE
/v2/projects/{PROJECT_ID}
/devices/{DEVICE_ID}
Delete the device for the provided device ID.
Be aware that deleting a device results in the removal of all associated resources. This includes device data, functions, and any widgets related to the devices within the project.
device.ts
import type { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
const projectId = "your_project_id";
const deviceId = "your_device_id";
const apiKey = "your_api_key";
try {
const result = await fetch(`https://api.qubitro.com/v2/projects/${projectId}/devices/${deviceId}`, {
headers: {
"Authorization": `Bearer ${apiKey}`
},
method: "DELETE"
});
const data = await result.json();
res.status(200).json(data);
} catch (error) {
console.error(`Error: ${error}`);
res.status(500).json({ message: 'Internal server error' });
}
}
Path Parameters
Option | Type | Description |
---|---|---|
PROJECT_ID | `String` | The ID of the project. |
DEVICE_ID | `String` | The ID of the device. |
Response
{
"success": "Boolean indicating the success of the request",
"action": "Description of the action taken by the server",
"status": "HTTP status code",
"message": "Message from the server describing the result of the operation",
"data": "Additional data related to the response (if applicable)"
}
Response codes
Option | Type | Description |
---|---|---|
200 | OK | The request was successful. |
400 | Bad Request | The request could not be understood or was missing required parameters. |
401 | Unauthorized | Authentication failed or was not provided. |
403 | Forbidden | Authentication succeeded, but the authenticated user does not have access to the requested resource. |
404 | Not Found | The requested resource could not be found. |
500 | Internal Server Error | An error occurred on the server. |
Start building today
Collect, process, and activate device data. Scale from one device to thousands.