API lowercases setup key group names #412

Closed
opened 2025-11-20 05:11:03 -05:00 by saavagebueno · 2 comments
Owner

Originally created by @clarkmcc on GitHub (Aug 7, 2023).

Describe the problem
When creating setup keys through the API, group names are lowercased, but are still case sensitive -- title cased group names are not found.

To Reproduce
When I POST to the endpoint /api/setup-keys with the following payload

{
  "name": "Testing key",
  "type": "one-off",
  "expires_in": 86400,
  "revoked": false,
  "auto_groups": [
    "Foobars"
  ],
  "usage_limit": 1
}

I get this error

{"message":"group foobars doesn't exist","code":404}

But I can create a setup key with "Foobars" through the UI.

Expected behavior
The setup key should be properly created

Originally created by @clarkmcc on GitHub (Aug 7, 2023). **Describe the problem** When creating setup keys through the API, group names are lowercased, but are still case sensitive -- title cased group names are not found. **To Reproduce** When I POST to the endpoint `/api/setup-keys` with the following payload ```json { "name": "Testing key", "type": "one-off", "expires_in": 86400, "revoked": false, "auto_groups": [ "Foobars" ], "usage_limit": 1 } ``` I get this error ```json {"message":"group foobars doesn't exist","code":404} ``` But I can create a setup key with "Foobars" through the UI. **Expected behavior** The setup key should be properly created
Author
Owner

@mlsmaycon commented on GitHub (Aug 8, 2023):

Hello @clarkmcc the auto_groups expect group IDs instead of names. You can get that with

GET /api/groups

@mlsmaycon commented on GitHub (Aug 8, 2023): Hello @clarkmcc the auto_groups expect group IDs instead of names. You can get that with GET /api/groups
Author
Owner

@clarkmcc commented on GitHub (Aug 8, 2023):

Ah, thanks

@clarkmcc commented on GitHub (Aug 8, 2023): Ah, thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#412