Creating a device in chirpstack application server using RestAPI

Hello,
I am trying to create a new device in chipstack application server via RestAPI, but unfortunately, I am getting an error for device profile ID. The error message is not so clear to me (since I am a beginner).

Here is the CURL message I tried:

curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ --header ‘Grpc-Metadata-Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJsb3JhLWFwcC1zZXJ2ZXIiLCJleHAiOjE2MDQ0OTY5ODEsImlzcyI6ImxvcmEtYXBwLXNlcnZlciIsIm5iZiI6MTYwNDQxMDU4MSwic3ViIjoidXNlciIsInVzZXJuYW1lIjoiYWRtaW4ifQ.NyKHZ1wMRHvEfgrbDyWZCdA8mOWSw6CR6s2I6zV28tQ’ -d ‘{ \
“device”: { \
“applicationID”: “20”, \
“description”: “All_in_One11”, \
“devEUI”: “647fda000000037c”, \
“deviceProfileID”: “Device-profile16_AllinOne”, \
“name”: “All_in_One11”, \
“referenceAltitude”: 0, \
“skipFCntCheck”: true, \
“tags”: {}, \
“variables”: {} \
} \
}’ ‘http://10.2.1.91:8080/api/devices

Response Body:
{
“error”: “uuid: incorrect UUID length: Device-profile16_AllinOne”,
“message”: “uuid: incorrect UUID length: Device-profile16_AllinOne”,
“code”: 3,
“details”: []
}

Response Code:
400

Response Headers:
{
“content-length”: “155”,
“content-type”: “application/json”,
“date”: “Wed, 04 Nov 2020 14:34:36 GMT”,
“grpc-metadata-content-type”: “application/grpc”,
“grpc-metadata-trailer”: “Grpc-Status, Grpc-Message, Grpc-Status-Details-Bin”
}

Could anyone help me what could be wrong here? The device profile “Device-profile16_AllinOne” has been already created and exists in the chirpstack NS! Any suggestions or hints would be very much appreciated!

Thanks in advance!

Regards,
Thangz

Hi Thangz,

The device profile Id that you are using is wrong, as the Id is not the name of the Device Profile.
The ID is a little bit hidden.
If you enter a device profile, you will see that you enter an URL like that:

You have to use the ID that I signed, the one after the last slash.

Try it.

Regards,

2 Likes

Hello Pulidoj,
Thank you so much! After entering the correct deviceprofileID as you mentioned, it worked now!

Regards,
Thangz