Hi,
I’m trying to add an End Device from an Android app using the HTTP API.
As indicated in the forum, I have used the console to add a device and I have used Chrome inspector to see the requests sent. I can see the 4 requests for:
- the Identity Server
- the Join Server
- the Network Server
- the Application Server
I’m now trying to replicate them in my Android App.
Here is what the Console is sending:
{
"end_device":{
"ids":{
"dev_eui":"6895280953AEADD5",
"join_eui":"ADD5A34886B3E6C8",
"device_id":"eui6895280953aeadd5"
},
"network_server_address":"eu1.cloud.thethings.network",
"application_server_address":"eu1.cloud.thethings.network",
"join_server_address":"eu1.cloud.thethings.network"
},
"field_mask":{
"paths":[
"network_server_address",
"application_server_address",
"join_server_address"
]
}
}
Here is what my Android application is sending:
{
"end_device":{
"ids":{
"dev_eui":"6895280953AEADD5",
"join_eui":"ADD5A34886B3E6C8",
"device_id":"eui6895280953AEADD5"
},
"network_server_address":"eu1.cloud.thethings.network",
"application_server_address":"eu1.cloud.thethings.network",
"join_server_address":"eu1.cloud.thethings.network"
},
"field_mask":{
"paths":[
"network_server_address",
"application_server_address",
"join_server_address"
]
}
}
And here is the error that I get:
NetworkUtility.shouldRetryException: Unexpected response code 400 for https://eu1.cloud.thethings.network/api/v3/applications/myloraapplication/devices
Body content:
{
"code":3,
"message":"error:pkg/errors:validation (invalid `end_device`: embedded message failed validation)",
"details":[
{
"@type":"type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
"namespace":"pkg/errors",
"name":"validation",
"message_format":"invalid `{field}`: {reason}",
"attributes":{
"field":"end_device",
"name":"CreateEndDeviceRequestValidationError",
"reason":"embedded message failed validation"
},
"correlation_id":"1b3aa9218cd145968ff89251b902105d",
"cause":{
"namespace":"pkg/errors",
"name":"validation",
"message_format":"invalid `{field}`: {reason}",
"attributes":{
"field":"ids",
"name":"EndDeviceValidationError",
"reason":"embedded message failed validation"
},
"correlation_id":"54422411c0f246ae96005c2d856c6dbd",
"cause":{
"namespace":"pkg/errors",
"name":"validation",
"message_format":"invalid `{field}`: {reason}",
"attributes":{
"field":"device_id",
"name":"EndDeviceIdentifiersValidationError",
"reason":"value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\""
},
"correlation_id":"b3243cae98de48dfbcdb67246bd4090b",
"code":3
},
"code":3
},
"code":3
}
]
}
Would you have an idea what I could have done wrong?
A side comment:
In the console, I have looked at the 4 requests. The first one is POST and the 3 others are PUT. I was expecting only POST requests.
Thank you!