[GH-ISSUE #3495] Create Group with Resource via API but Resource does not appear. #7464

Open
opened 2026-08-05 01:13:08 -04:00 by saavagebueno · 3 comments
Owner

Originally created by @YapWC on GitHub (Mar 13, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/3495

Originally assigned to: @pascal-fischer on GitHub.

I am testing out Netbird API and created a Group with the following python code excluded the peer.

import requests
import json

url = "https://<my_network>/api/groups"
payload = json.dumps({
  "name": "devs",
  "resources": [
    {
      "id": "chacdk86lnnboviihd7g",
      "type": "host"
    }
  ]
})
headers = {   
  'Content-Type': 'application/json',  
  'Accept': 'application/json',
  'Authorization': 'Token <my_token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

It was successfully created with this being returned.
{"id":"cv9cidkig2os73e68gng","issued":"api","name":"devs","peers":null,"peers_count":0,"resources":[{"id":"chacdk86lnnboviihd7g","type":"host"}],"resources_count":1}

But when I went to the Netbird Dashboard I don't see a network resource even though it shows in devs group that there is 1 Network Resource associated.
Image
Image

I tried to delete the Network Resource via API but got null in return. Now I am not sure how I can delete it.

Originally created by @YapWC on GitHub (Mar 13, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/3495 Originally assigned to: @pascal-fischer on GitHub. I am testing out Netbird API and created a Group with the following python code excluded the peer. ``` import requests import json url = "https://<my_network>/api/groups" payload = json.dumps({ "name": "devs", "resources": [ { "id": "chacdk86lnnboviihd7g", "type": "host" } ] }) headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token <my_token>' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) ``` It was successfully created with this being returned. `{"id":"cv9cidkig2os73e68gng","issued":"api","name":"devs","peers":null,"peers_count":0,"resources":[{"id":"chacdk86lnnboviihd7g","type":"host"}],"resources_count":1}` But when I went to the Netbird Dashboard I don't see a network resource even though it shows in devs group that there is 1 Network Resource associated. <img width="1184" alt="Image" src="https://github.com/user-attachments/assets/c84a9fbd-9e7d-4f48-b95a-43c609632a30" /> <img width="1393" alt="Image" src="https://github.com/user-attachments/assets/7ebc4ac7-4990-4d65-ac0a-683beee62e4a" /> I tried to delete the Network Resource via API but got null in return. Now I am not sure how I can delete it.
saavagebueno added the bugmanagement-serviceapi labels 2026-08-05 01:13:08 -04:00
Author
Owner

@pascal-fischer commented on GitHub (Mar 13, 2025):

Hi @YapWC,

did you ever create a resource? I saw you created a group and assigned a resourceID to that group. The groups endpoint does not check if all the peers and resources you define actually exist. So my guess is the script just added a non-existing ID to the group. To delete the group just keep using the API. Send an update request for the group with an empty array of resources. That should clear the group and you will be able to delete it from the dashboard.

I will note for us to update the groups endpoint to actually check the existence of a resource before adding it to the group.

<!-- gh-comment-id:2721427047 --> @pascal-fischer commented on GitHub (Mar 13, 2025): Hi @YapWC, did you ever create a resource? I saw you created a group and assigned a resourceID to that group. The groups endpoint does not check if all the peers and resources you define actually exist. So my guess is the script just added a non-existing ID to the group. To delete the group just keep using the API. Send an update request for the group with an empty array of resources. That should clear the group and you will be able to delete it from the dashboard. I will note for us to update the groups endpoint to actually check the existence of a resource before adding it to the group.
Author
Owner

@YapWC commented on GitHub (Mar 17, 2025):

Hi @pascal-fischer yeap your explanation is spot on and I have tried your method to update the group with empty resource and was able to delete the user after that. Thanks for the help and proactiveness, much appreciated!

<!-- gh-comment-id:2731372543 --> @YapWC commented on GitHub (Mar 17, 2025): Hi @pascal-fischer yeap your explanation is spot on and I have tried your method to update the group with empty resource and was able to delete the user after that. Thanks for the help and proactiveness, much appreciated!
Author
Owner

@matteoepitech commented on GitHub (Jun 27, 2026):

I picked this up. Following your note about checking resource existence on the groups endpoint, validateNewGroup now verifies every referenced network resource via GetNetworkResourceByID, so create, update and bulk group operations reject unknown resource IDs with a NotFound error instead of silently accepting them. Clearing a group's resources with an empty list still works, so the recovery path you described stays valid. PR: https://github.com/netbirdio/netbird/pull/6559

<!-- gh-comment-id:4818004932 --> @matteoepitech commented on GitHub (Jun 27, 2026): I picked this up. Following your note about checking resource existence on the groups endpoint, validateNewGroup now verifies every referenced network resource via GetNetworkResourceByID, so create, update and bulk group operations reject unknown resource IDs with a NotFound error instead of silently accepting them. Clearing a group's resources with an empty list still works, so the recovery path you described stays valid. PR: https://github.com/netbirdio/netbird/pull/6559
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#7464