Device auth API: device ID from preauthorize

I’m trying to use the device auth API to automatically authorize devices as part of a more complex provisioning process. I find it strange that the preauthorization API call (https://docs.mender.io/2.0/apis/management-apis/device-authentication#devices-post) doesn’t return the ID of the created device. The ID would be very useful to later check that the device shows up as “authorized” when it connects to the backend or to remove the device again if something else goes wrong. The documentation also states that the Device resource should be returned if trying to preauthorize an existing device, but when testing using the demo setup on version 2.0.0, only an error is returned. A quick look at the source code (https://github.com/mendersoftware/deviceauth/blob/master/api/http/api_devauth.go#L216) seems to confirm this. This means that in order to determine the device ID, I’d have to manually list all the devices and search them for the public key that I just submitted. Is there a reason why the ID isn’t returned?

This is not really my area, but agree that there are some inconsistencies here that would need some additional clarifications.

I would suggest you to file a ticket here,

http://tracker.mender.io/

with your findings so far.