Get device status in a campaign
# Get Device Status in a Campaign ### `GET /reports/{accountName}/campaigns/{campaignId}/devices` Returns a list of all devices in a campaign and the status of each device. ## Uses and Requirements Each response includes a maximum of 1,000 devices. If the report contains more than 1,000 devices (indicated by the `hasMoreData` parameter in each response), you must send additional requests to retrieve the remaining devices. Use the `lastSeenDeviceId` parameter to return a different set of devices in each response. ## HTTP Request GET [https://thingspace.verizon.com/api/fota/v2/reports/{accountName}/campaigns/{campaignId}/devices](/docs/premium-apis/software-management/software-management-v2/api-endpoints/software-management-reports-v2/getcampaigndevicestatus) ## Resource Path and Query Parameters You must include the account name in the path and campaignId in the resource path. | Parameter Name | Data Type | Description | |:---------------------|:-----------|:---------------------------------------------------------------------------------------------| | **accountName** <br> *required* | string | The name of the account for which you want the list of devices. An account name is usually numeric, and must include any leading zeros. | | **campaignId** <br> *required* | string | Software upgrade identifier, returned in the "id" value of the `POST /{campaigns}/acc` response when the upgrade was scheduled. | | **lastSeenDeviceId** <br> *query* | string | Only return devices with IMEIs larger than this value. Use 0 for the first request. If `hasMoreData`=true in the response, use the `lastSeenDeviceId` value from the response in the next request. | ## Header Parameters The request header must contain a current ThingSpace authorization token and a current VZ-M2M session token. For more details on how to get these tokens, visit [Getting Started](https://thingspace.verizon.com/documentation/api-documentation.html#/http/session-management/guides/getting-started). | Parameter Name | Data Type | Description | |:-----------------------|:-----------|:-----------------------------------------------------------------------------| | **Authorization** <br> _required_ | string | HTTP Authorization bearer token: <br> `Authorization: Bearer {token}` | | **VZ-M2M-Token** <br> _required_ | string | A valid session token: <br> `VZ-M2M-Token: {M2Mtoken}` | ## Request Body None. ## Example Request Request the list of devices for an account: ```json curl GET https://thingspace.verizon.com/api/fota/v2/reports/{accountName}/campaigns/{campaignId}/devices \ -H 'VZ-M2M-Token: {M2M token}' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer {bearer token}' \ ``` ## Success Responses **Status 200** A success response contains the account name and an array of device objects. | Parameter Name | Data Type | Description | |:----------------------|:--------------|:---------------------------------------------------------------------------------------------| | totalDevice | string | The total number of devices in the campaign. | | hasMoreData | boolean | True if there are more devices to retrieve. | | lastSeenDeviceId | string | If `hasMoreData`=true, use this value for the next request. 0 if `hasMoreData`=false. | | maxPageSize | integer | Maximum number of results included in the response. | | deviceList | array | The list of devices in the account. | | deviceList.deviceId | string | The IMEI of the device. | | deviceList.status | string | The upgrade status of the device, either UpgradeSuccess or upgradeFailure. | | deviceList.resultReason | string | The reason for the upgrade status. | ## Example Success Response This example response has been shortened to only show three devices, although there were over 1,000 devices in the original response, as indicated by `hasMoreData` = true. ```json { "totalDevice": 1148, "hasMoreData": true, "lastSeenDeviceId": "15-digit IMEI", "maxPageSize": 1000, "deviceList": [ { "deviceId": "15-digit IMEI", "status": "UpgradeSuccess", "resultReason": "DownloadInstallSucceeded" }, { "deviceId": "15-digit IMEI", "status": "UpgradeSuccess", "resultReason": "DownloadInstallSucceeded" }, { "deviceId": "15-digit IMEI", "status": "UpgradeSuccess", "resultReason": "DownloadInstallSucceeded" } ] } ``` `hasMoreData` = true means there is more than the first 1000. `lastSeenDeviceId` should be used for pagination. So, to get devices beyond the first 1000, run a follow-up API request such as: ```json curl --location --request GET 'https://thingspace.verizon.com/api/fota/v2/reports/{accountName}/campaigns/{campaignId}/devices?lastSeenDeviceId=15-digit IMEI' ``` ## Failure Responses **Status 400** All error messages are returned in this format: ```json { "errorCode": "error code string", "errorMessage": "error message string" } ``` Error codes and messages are listed on the Error Messages page, along with explanations and suggestions for corrective actions.