پرش به مطلب اصلی

Devices API

POST /getDevices

Description

This API endpoint retrieves the list of devices associated with a specific user, including details about their connection and status.

Request Body

The request uses GraphQL to perform the getDevices query.

Query:

query getDevices ($userId: Int!) {
getDevices (userId: $userId) {
deviceAppType
deviceOsType
appVersion
lastConnectionStartTime
lastConnectionStopTime
isConnected
lastSessionId
isDeactivated
lastConnectedServerId
lastConnectedServerCountry
lastConnectedServerCity
}
}

GraphQL Variables:

{
"userId": 0
}

Example Request:

curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query getDevices ($userId: Int!) {\n getDevices (userId: $userId) {\n deviceAppType\n deviceOsType\n appVersion\n lastConnectionStartTime\n lastConnectionStopTime\n isConnected\n lastSessionId\n isDeactivated\n lastConnectedServerId\n lastConnectedServerCountry\n lastConnectedServerCity\n }\n}","variables":{"userId":0}}'

Response:

  • Success (200 OK):

    • The response includes details about the devices associated with the specified user.
    {
    "data": {
    "getDevices": [
    {
    "deviceAppType": "Mobile",
    "deviceOsType": "iOS",
    "appVersion": "1.2.3",
    "lastConnectionStartTime": "2024-08-11T10:00:00Z",
    "lastConnectionStopTime": "2024-08-11T10:15:00Z",
    "isConnected": true,
    "lastSessionId": "session123",
    "isDeactivated": false,
    "lastConnectedServerId": 45,
    "lastConnectedServerCountry": "USA",
    "lastConnectedServerCity": "New York"
    }
    ]
    }
    }
    • Fields:
      • deviceAppType: The type of application running on the device (e.g., Mobile, Web).
      • deviceOsType: The operating system of the device (e.g., iOS, Android).
      • appVersion: The version of the application.
      • lastConnectionStartTime: The start time of the last connection.
      • lastConnectionStopTime: The stop time of the last connection.
      • isConnected: Indicates whether the device is currently connected.
      • lastSessionId: The ID of the last session.
      • isDeactivated: Indicates whether the device has been deactivated.
      • lastConnectedServerId: The ID of the last connected server.
      • lastConnectedServerCountry: The country of the last connected server.
      • lastConnectedServerCity: The city of the last connected server.
  • Error (4XX/5XX):

    • If there is an issue with the request or a server error occurs, the response will include an error message and status code.

Parameters:

  • userId (Int): The ID of the user whose devices you want to retrieve.

Note:

This endpoint provides detailed information about the devices used by a specific user, including their connection status and recent activities. Adjust the userId parameter as needed to get data for the desired user.