0

according to the google's guide Error responses, I can return an error response when some errors occur in my cloud service.So, I want to try:

{
    "requestId": "13711695294173375391",
    "payload": {
        "commands": [
            {
                "status": "ERROR",
                "ids": [
                    "5a1cbc26e4b0532d095e72a0"
                ],
                "errorCode": "authExpired"
            }
        ],
        "errorCode": "authExpired"
    }
}

but this syntax doesn't work.what's the correct usage of error response,can anyone give me a example?

eric zhao
  • 165
  • 3
  • 15

1 Answers1

0

There are two examples of errors that you can use as a basis for returning a problem with a device or fulfillment in general. It looks like you are using both, but you should use it at one of those levels, ie. either

{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "commands": [{
      "ids": ["456"],
      "status": "ERROR",
      "errorCode": "deviceTurnedOff"
    }]
  }
}

or

{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "errorCode": "notSupported"
  }
}
Nick Felker
  • 11,536
  • 1
  • 21
  • 35