Unlock FW via REST API request


I’m having some troubles trying to unlock my devices via a REST API client i am programming.
So far, locking a FW to a device works fine, but when it comes to unlock, I keep receiving this error. " error: nothing to do ? "

   request.AddParameter("desired_firmware_version", null);
   IRestResponse response = client.Execute(request);

Is there a problem setting the “desired_firmware_version” field to " null " ? I have tried doing this:
int? value = null;


     request.AddParameter("desired_firmware_version", value );

Still showing the same error.

Thank you !

My guess is that the API is expecting a JSON null value to mean unlock the firmware. Your request is not getting converted in a compatible fashion.

What I’d try is forcing the request into JSON mode instead of form data, and explicitly using a JSON null value as the desired_firmware_version.

I’ve been following the example requests so far:

$ curl https://api.particle.io/products/:productIdOrSlug/devices/12345
-d desired_firmware_version=null
-d access_token=123abc

It’s been perfectly working until this very precise request. So I should upload a JSON even though it’s just supposed to be a null value for the desired_firmware_version ? For the " Lock FW " request, a number for the version is required, it works well.

First try:

request.AddParameter("desired_firmware_version", "null");

and see if that works. If not, then you can try something more complicated.

Well, the JSON idea worked ! It looks like there’s some issue with sending a null value through the data form.
Thank you @rickkas7 !