Device Check

The Device Check API is used to perform a device check. It is recommended to send this request every 5 minutes to ensure the device's status is up-to-date.

Important Note:

If the value of device_management is set to 1, which means that the system is enabled. This configuration is obtained from the server at the endpoint /api/base/configs. The system will remain enabled until you explicitly disable it.

On the other hand, if the value of device_management is anything other than 1, the system is considered disabled.

To provide a seamless user experience, it is essential to handle the error message display only when the device_banned status code is received. In all other cases, no error code should impact the user experience. Prioritizing a smooth user interaction, ensure that unnecessary interruptions or error messages for non-banned devices are avoided.

Furthermore, to maintain an uninterrupted user experience, it is recommended to verify that the device has an active internet connection before sending these requests. If the internet is not connected, refrain from sending these requests to prevent any adverse effects on the user experience.

API Route

{{apiBase}}/v2/device_check

Request

  • Method: POST

Parameters

The API expects the following parameter to be included in the request's body:

  • mac_address: The MAC address of the device.

Success Response

  • Status: 200

  • Description: Indicates a successful device check.

  • Body: The response body contains information about the device check.

{
    "status": 200,
    "timestamp": 1684581058,
    "time": 0.371,
    "ip": "127.0.0.1",
    "message": "Success",
    "data": {
        "mac_address": "A1B2C3D4E5F6",
        "status": 1,
        "ban_status": 0
    }
}

Error Response

  • Status: 400

  • Description: Indicates an error occurred during the device check.

  • Body: The response body provides information about the specific error that occurred.

Device Banned

If you receive the error code device_banned, display a black screen with the error message.

{
    "status": 400,
    "timestamp": 1684580963,
    "time": 0.548,
    "ip": "127.0.0.1",
    "message": "Your device has been banned. Please contact support.",
    "error_code": "device_banned",
    "data": []
}

Device Not Found

If you receive the error code device_not_found, make the "add device" call first.

{
    "status": 400,
    "timestamp": 1684581434,
    "time": 0.505,
    "ip": "127.0.0.1",
    "message": "Device not found",
    "error_code": "device_not_found",
    "data": []
}

Usage Example

{
    "mac_address": "A1B2C3D4E5F6"
}

Notes

  • The mac_address parameter is used to identify the device to be checked.

  • If the mac_address matches an existing device, the API will return a 200 status with information about the device.

  • If the mac_address does not match any existing device, the API will return a 400 status with an appropriate error message.

  • Additional error handling or logic may be present in the actual implementation.

Last updated