Can I generate a device key through the API?

I know how to generate the device key using the dashboard but is it possible to do that through the API … I have a bunch of devices and I’d really like to be able to generate those keys without all those clicks.

Yes:

POST to /csr/sources with the deviceid parameter

Thanks for that but that method gives me the “current” keys but doesn’t generate a key for a device that I haven’t generated one through the dashboard. When post without a deviceid parameter I get a list of all the devices that have a devicekey with their parameters … but only those I manually generated a key for. If I post with a deviceid that I haven’t set a key for on the dashboard, then I get a “success” but empty response.

Hmm, are you sure you’re doing a POST and not a GET? I just tested and it seems to be working properly. I did a POST to /csr/sources with the deviceid as one of the parameters passed into the request for a device that didn’t have a device key and the response came back with the new device key.

Yep, my mistake … was “getting” instead of "posting"
Life is good again, thanks!

1 Like

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