Registering a new gateway with V3 API

Hi,
I’m trying to register a new gateway through the v3 API. I’ve had success with registering/deleting devices, but the API for the gateways seems to be confusing me.

I have the usual headers with bearer token etc.
The raw data I’m sending is

{
“gateway”: {“ids”:
{
“gateway_id”: “eui-c0ee40ffffxxxxx”,
“eui”: “xxxxxxxxxxxxxxxx”
},
“name”: “test-gateway”,
“gateway_server_address”: “tenant_name.eu1.cloud.thethings.industries”,
“frequency_plan_id”: “AS_923”
}
}
The POST request is as follows
https://tenant_name.eu1.cloud.thethings.industries/api/v3/users/username@tenant_name/gateways

And the response I get back is as follows

{
“code”: 3,
“message”: “error:pkg/errors:validation (invalid collaborator: 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”: “collaborator”,
“name”: “CreateGatewayRequestValidationError”,
“reason”: “embedded message failed validation”
},
“correlation_id”: “e30da9e72fcf4f1a8e9a79266b26823c”,
“cause”: {
“namespace”: “pkg/errors”,
“name”: “validation”,
“message_format”: “invalid {field}: {reason}”,
“attributes”: {
“field”: “user_ids”,
“name”: “OrganizationOrUserIdentifiersValidationError”,
“reason”: “embedded message failed validation”
},
“correlation_id”: “078e82453c7b468ca8ee2cd0a3718f41”,
“cause”: {
“namespace”: “pkg/errors”,
“name”: “validation”,
“message_format”: “invalid {field}: {reason}”,
“attributes”: {
“field”: “user_id”,
“name”: “UserIdentifiersValidationError”,
“reason”: “value does not match regex pattern "^a-z0-9{1,}$"”
},
“correlation_id”: “43236594c2444191bfbeaca494c739e6”,
“code”: 3
},
“code”: 3
},
“code”: 3
}
]
}

Many thanks

Please format logs & JSON with the </> tool - click the … button for the pencil tool to edit your post.

Plus what does the error message tell you - all the info you need is there!

Thanks Nick,
That got me a little further, but I’m having access rights issues.
"message":"error:pkg/auth/rights:no_user_rights (no rights for user user@company)"

On the console I’m set up as a Admin with all rights? Am I using the wrong API key? Or is there somewhere that I’m missing for enabling the gateway create rights?

Many thanks

Is your tenant name really tenant-name?

Look at the URL you are using on the console and look at what you’ve got in the JSON.

No, that was just to hide the company name. Sorry I should have stated the URL has changed to use
https://'company-name'.eu1.cloud.thethings.industries/api/v3/users/'user-name'/gateways

The ‘company-name’ and ‘user-name’ are my valid logins details. I can use then successfully to register an end device with the API.

Many thanks

Yeah, redaction, doesn’t work for the CIA either - the only real secrets are AppKeys, API keys & passwords!


That API url looks off, I mostly do stuff with devices on the CLI and I don’t recall it pointing to a user endpoint unless you are doing something with users - maybe worth reviewing the docs. I’ll have a squint later, got to herd some staff & cats.

As to the API key, you’ll have to use your master one that is in your personal settings.