# Bulk device states

## Bulk Device States

<mark style="color:blue;">`GET`</mark> `https://api.connect.jfrog.io/v1/get_devices_state`

Using this call you will get the current state - `Online` or `Offline` on a bulk of devices.

#### Request Body

| Name          | Type    | Description                                                                                                                                        |
| ------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| user\_token   | string  | This is your account token. You can find it under the Settings category on the dashboard.                                                          |
| group\_name   | string  | This is the group name of the group you would like to get all its devices state.                                                                   |
| project\_name | string  | This is the project name of the project you would like to get all its devices state.                                                               |
| limit         | integer | <p>The number of results per page.<br><em>The maximum <code>limit</code> is 50.</em><br><strong>Default is 20.</strong></p>                        |
| offset        | integer | <p>Offset to start pagination search results.<br><strong>This should be the last <code>device\_uuid</code> from the previous request.</strong></p> |

{% tabs %}
{% tab title="200  The value of the "message" parameter is a JSON object with the keys:

1. device\_status - String - can be either online or offline values.
2. device\_id - Integer - This is the ID of the device which you have sent at the request.
3. device\_name - String - This is the name of the device." %}

```
{"message": {"device_status": "online",
             "device_uuid": "d-1234-abcd",
             "device_name": "My-Device-1"}}
```

{% endtab %}

{% tab title="400 Error occurred." %}

```
{"error_message": "<ERROR_MESSAGE>"}
```

{% endtab %}

{% tab title="429 Rate limit reached." %}

```
{}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If no parameters are set, the first 20 devices of that user will be returned.
{% endhint %}

#### Example

{% tabs %}
{% tab title="Python" %}

```python
import json
import requests
json_content = {'project_name': 'MYPROJECT',
                'group_name': 'Production',
                'user_token': 'YYYYYYYYYYYYYYY'}

call_request = requests.get("https://api.connect.jfrog.io/v1/get_devices_state", json=json_content)
call_response = json.loads(call_request.text)

if call_request.status_code != 200:
    if call_request.status_code == 429:
        error = "API limit reached"
    else:
        error = call_response["error_message"]
    print(error)
else:
    for device in call_response["message"]:
        device_status = device["device_status"]
        device_uuid = device["device_uuid"]
        device_name = device["device_name"]

```

{% endtab %}

{% tab title="Curl" %}

```shell
curl --location --request GET 'https://api.connect.jfrog.io/v1/get_devices_state' \
--header 'Content-Type: application/json' \
--data-raw '{
    "user_token": "YYYYYYYYYYYYYYY"
    }'
```

{% endtab %}
{% endtabs %}
