Create device profile with given ID via REST API

I’m trying to use the HTTP REST API for creating a device profile. The device profile UUID (/ID) is also needed by other service for reference purposes (basically creating a device with a given device profile).

My problem is that every time I create the device profile with the same information, it has a different ID, e.g., b1d9f4e0-06e5-4166-a5f1-39055d53cdbc the first time and 19990b47-496e-4d82-a136-c0e6b208c401 the second time, etc. If I could create a profile with a statically known profile ID, then I the other dependent services could also use that without some sort of communication between them.

The swagger docs tell me the /api/device-profiles API can accept an id string in its JSON payload.

However, even if I give it this string, it still creates the profile with a different ID.

Example payload

{'deviceProfile': {'adrAlgorithmID': 'default', 'factoryPresetFreqs': [868100000, 868300000, 868500000, 867100000, 867300000, 867500000, 867000000, 867900000], 'id': '19990b47-496e-4d82-a136-c0e6b208c401', 'macVersion': '1.0.2', 'maxEIRP': 12, 'name': 'OTAA', 'networkServerID': '1', 'organizationID': '1', 'regParamsRevision': 'B', 'rxDataRate2': 3, 'rxDelay1': 1, 'rxFreq2': 869525000, 'supportsClassB': False, 'supportsClassC': False, 'supportsJoin': True, 'tags': {}, 'uplinkInterval': '86400s'}}

Resulted in the profile <host>/#/organizations/1/device-profiles/099568f1-b15c-4f36-a94a-0adb88217056 being created – the id parameter seems ignored (although the rest of the profile creation works just fine with the given parameters).

Is there a way to create fixed-ID device profiles through the REST API?

Furhter investigating this by looking int the chirpstack application server code revela sthat the API call goes into some Go code where the device profile is created with https://github.com/brocaar/chirpstack-application-server/blob/master/internal/api/external/device_profile.go#L38-L115. A storage.DeviceProfile object is created (where the ID field is not taken from the request)

and the storage.CreateDeviceProfile function…

Alloactes a new UUID and inserts that into the database. So the "id" field seems to go absolutely unused and creating a new profile always results in a new UUID.

Issue about misleading documentation opened at Swagger docs misleading on "id" field · Issue #686 · brocaar/chirpstack-application-server · GitHub.