Device Status (PUT)

Changes the status of a specific device.

Description

A device can be marked as active, lost, stolen, disabled, or expired. Lost, stolen, or disabled devices cannot access the server. A device is marked expired if it has not connected to the MobileFirst server for 90 days.

This transaction can run synchronously or asynchronously. If the transaction is processed asynchronously, the REST service returns before the transaction is completed. In this case, you can query the transaction result later by using the transaction REST service.

Roles

Users in the following roles are authorized to perform this operation:

  • mfpadmin
  • mfpdeployer
  • mfpoperator

Method

PUT

Path

/management-apis/2.0/runtimes/runtime-name/devices/device-id

Example

https://www.example.com/mfpadmin/management-apis/2.0/runtimes/myruntime/devices/12345-6789?async=false&locale=de_DE

Path Parameters

runtime-name
The name of the runtime. This is the context root of the runtime web application, without the leading slash.
device-id
The device id.

Query Parameters

Query parameters are optional.

async
Whether the transaction is processed synchronously or asynchronously. The allowed values are true and false. By default, transactions are processed in synchronous mode.
locale
The locale used for error messages.

Consumes

application/json

Produces

application/json, application/xml, text/xml

Payload

JSON Example

{
  "status" : "LOST",
}

Payload Properties

The payload has the following properties:
status
The new status of the device: ACTIVE, LOST, STOLEN, EXPIRED, DISABLED.

Response

The metadata of the transaction.

JSON Example

{
  "ok" : false,
  "productVersion" : "8.0",
  "transaction" : {
    "appServerId" : "Tomcat",
    "description" : {
      "deviceId" : "12345-6789",
      "status" : "LOST",
    },
    "errors" : [
      {
        "details" : "An internal error occured.",
      },
      ...
    ],
    "id" : 1,
    "project" : {
      "name" : "myproject",
    },
    "status" : "FAILURE",
    "timeCreated" : "2014-04-13T00:18:36.979Z",
    "timeUpdated" : "2014-04-14T00:18:36.979Z",
    "type" : "CHANGE_DEVICE_STATUS",
    "userName" : "demouser",
  },
}

XML Example

<?xml version="1.0" encoding="UTF-8"?>
<set-device-status-result
  ok="false"
  productVersion="8.0">
  <transaction
    appServerId="Tomcat"
    id="1"
    status="FAILURE"
    timeCreated="2014-04-13T00:18:36.979Z"
    timeUpdated="2014-04-14T00:18:36.979Z"
    type="CHANGE_DEVICE_STATUS"
    userName="demouser">
    <description
      deviceId="12345-6789"
      status="LOST"/>
    <errors>
      <error details="An internal error occured."/>
      ...
    </errors>
    <project name="myproject"/>
  </transaction>
</set-device-status-result>

Response Properties

The response has the following properties:

ok
Whether the transaction was successful.
productVersion
The exact product version.
transaction
The details of the transaction.

The transaction has the following properties:

appServerId
The id of the web application server.
description
The details of the status change.
errors
The errors occurred during the transaction.
id
The id of the transaction.
project
The current project.
status
The state of the transaction: PENDING, PREPARING, COMMITTING, REJECTING, SUCCESS, FAILURE, CANCELED. Synchronous transactions can have the state SUCCESS and FAILURE. Asynchronous transactions can also have the other states.
timeCreated
The date in ISO 8601 format when the adapter was created.
timeUpdated
The date in ISO 8601 format when the adapter was updated.
type
The type of the transaction, here always CHANGE_DEVICE_STATUS.
userName
The user that initiated the transaction.

The description has the following properties:

deviceId
The device id.
status
The status of the device: ACTIVE, LOST, STOLEN, EXPIRED, DISABLED.

The error has the following properties:

details
The main error message.

The project has the following properties:

name
The name of the project, which is the context root of the runtime.

Errors

400
The payload is invalid.
403
The user is not authorized to call this service.
404
The corresponding runtime or the device is not found.
500
An internal error occurred.