JSON name changes in API breaks userland!

Today my app stopped working because of name changes in the API. Field lastHeard in GET device information is now last_handshake_at, and a similar change is done in CoreInfo when calling a function. Shouldn’t name changes like this be handled with a new version of the API since it breaks user code?

My app now requires a new build and release to fix this. :unamused:

Which API name change are you refering to?

GET https://api.particle.io/v1/devices/:deviceId

According to docs it should return

HTTP/1.1 200 OK
{
  "id": "0123456789abcdef01234567",
  "name": "gongbot",
  "variables": {
    "Gongs": "int32"
  },
  "functions": [
    "gong",
    "goto"
  ],
  "connected": true,
  "platform_id": 6,
  "product_id": 6,
  "system_firmware_version": "0.7.0"
  "cellular": false,
  "serial_number": "AAAAAA111111111"
  "last_ip_address": "176.83.211.237",
  "last_heard": "2015-07-17T22:28:40.907Z",
  "notes": null,
  "firmware_updates_enabled": true,
  "firmware_updates_forced": false
}

But actual return is now

{
  "id": "3000xxxxxxx",
  "name": "xxxxx",
  "last_app": null,
  "last_ip_address": "81.xxxxxxx",
  "last_handshake_at": "2020-03-16T07:35:07.306Z",
  "product_id": 6,
  "connected": true,
  "platform_id": 6,
  "cellular": false,
  "notes": null,
  "status": "normal",
  "serial_number": "PH-xxxxxxxxx",
  "current_build_target": "1.4.4",
  "system_firmware_version": "1.4.4",
  "default_build_target": "1.4.4",
  "variables": {
    "heatingState": "int32"
  },
  "functions": [
    "heating"
  ],
  "firmware_updates_enabled": true,
  "firmware_updates_forced": false
}

The field last_heard is now last_handshake_at

The same goes for GET /v1/devices/:deviceId/:varName, where the response is

{
  "cmd": "VarReturn",
  "name": "xxxx",
  "result": 1,
  "coreInfo": {
    "last_app": "",
    "connected": true,
    "last_handshake_at": "2020-03-16T07:35:07.306Z",
    "deviceID": "3000xxxxxxx",
    "product_id": 6
  }
}

last_heard is seemingly replaced by last_handshake_at (in this case documentation is in sync with actual data)

Thanks for the clarification, now someone from Particle can chime in with a better targeted answer.
@rickkas7? :wink:

Hey @ejeklint thanks for the post, and sorry to hear this. :confused: I’ll investigate here further and will be back in touch soon.

1 Like

Hey @ejeklint, I just spoke with the team and it looks like this was a temporary error during the release that should be resolved if you try again. We needed to run a db migration that took a bit, which is likely why you saw this when you did.

So try again, and let me know if things are ok for you now.

1 Like

Yep, it’s resolved. :slight_smile:

1 Like

glad to hear it. sorry again about the disruption!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.