[Solved] Flashing With Access Token In Request Body Fails

This is perhaps just a minor documentation issue, but I thought I’d report it.

When I attempt to flash a new firmware binary via the exact curl command listed in the documentation, I receive an error.

From here: https://docs.particle.io/reference/api/#flash-a-device-with-a-pre-compiled-binary

The listed curl command to flash is:

$ curl -X PUT -F file=@my-firmware-app.bin -F file_type=binary -F access_token=1234 https://api.particle.io/v1/devices/0123456789abcdef01234567

However, that generates this error:

{
  "error": "invalid_request",
  "error_description": "When putting the token in the body, content type must be application/x-www-form-urlencoded."
}

I can easily put the access token in the header or in the URL, so this is not blocking me. For example, this works fine:

$ curl -X PUT -F file=@firmware.bin -F file_type=binary https://api.particle.io/v1/devices/0123456789abcdef01234567?access_token=1234

Just an issue with the documentation? Or maybe I’m reading the docs wrong. Not a big deal at all, but thought I’d mention it.

2 Likes

Awesome, thanks, that fixed the same issue I had

Thanks! The example is now fixed in the documentation.