API for adding team to org and repo isn't working #4089

Closed
opened 2025-11-02 05:37:17 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @thestepafter on GitHub (Oct 10, 2019).

  • Gitea version (or commit ref): 1.9.3
  • Git version: 2.17.1
  • Operating system: Ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Per the Swagger docs I am running the following command to try and add an existing team to an organization and repo since it doesn't appear to be possible to do this in the frontend UI and I don't want to have to create a different team with the same users for every repo (over 70).

curl -X PUT "https://git.domain.com/api/v1/teams/{{team_id}}/repos/{{organization_name}}/{{repo_name}} -H accept: application/json" -H "authorization: Basic ZGFseWlkfsjaflkjdsflksfFSJLFlfkJLFKjFLKdjRA=="

But when I run the above command I get this error. All other API commands I am running with curl work perfectly fine.

{"documentation_url":"https://git.domain.com/api/swagger","errors":null,"message":"Not Found"}%
Originally created by @thestepafter on GitHub (Oct 10, 2019). - Gitea version (or commit ref): 1.9.3 - Git version: 2.17.1 - Operating system: Ubuntu 18.04 - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Per the Swagger docs I am running the following command to try and add an existing team to an organization and repo since it doesn't appear to be possible to do this in the frontend UI and I don't want to have to create a different team with the same users for every repo (over 70). ``` curl -X PUT "https://git.domain.com/api/v1/teams/{{team_id}}/repos/{{organization_name}}/{{repo_name}} -H accept: application/json" -H "authorization: Basic ZGFseWlkfsjaflkjdsflksfFSJLFlfkJLFKjFLKdjRA==" ``` But when I run the above command I get this error. All other API commands I am running with curl work perfectly fine. ``` {"documentation_url":"https://git.domain.com/api/swagger","errors":null,"message":"Not Found"}% ```
Author
Owner

@guillep2k commented on GitHub (Oct 10, 2019):

Sorry if I misunderstand your question and state the obvious here. Teams are not added to an organization. Teams are created inside an organization. For example each organization has its own Owners team which is different for each one. Organizations can have teams with the same name as other oranizations', but the teams will be different and unique.

@guillep2k commented on GitHub (Oct 10, 2019): Sorry if I misunderstand your question and state the obvious here. Teams are not added to an organization. Teams are _created_ inside an organization. For example each organization has its own `Owners` team which is different for each one. Organizations can have teams with the same name as other oranizations', but the teams will be different and unique.
Author
Owner

@thestepafter commented on GitHub (Oct 10, 2019):

Thank you for the prompt reply @guillep2k!

So if I am understanding correctly, teams are unique to organizations so if I want to have a development and quality-assurance team for each organization I need to create that team for each organization, of which I have over 50. Then when I hire someone on the development team to support our customers I need to add them manually to every organization development team?

@thestepafter commented on GitHub (Oct 10, 2019): Thank you for the prompt reply @guillep2k! So if I am understanding correctly, teams are unique to organizations so if I want to have a development and quality-assurance team for each organization I need to create that team for each organization, of which I have over 50. Then when I hire someone on the development team to support our customers I need to add them manually to every organization development team?
Author
Owner

@guillep2k commented on GitHub (Oct 10, 2019):

Perhaps organizations were not created for this? I can't possibly know your reasons, but maybe you can use only one organization and split access into several teams; then you can add repos to teams accordingly. Especially if you have some overlapping between teams (e.g. the same person is present in more than one project). In my company we do it that way; we have two main branches in different countries, thus two organizations. But each country have several teams, and for instance the same coder could be assigned to "devs-project1" and "devs-project34"; same for QA, etc. Only people assigned to "*-project34" can see its repos. In our case it makes more sense from the management point of view.

@guillep2k commented on GitHub (Oct 10, 2019): Perhaps organizations were not created for this? I can't possibly know your reasons, but maybe you can use only one organization and split access into several teams; then you can add repos to teams accordingly. Especially if you have some overlapping between teams (e.g. the same person is present in more than one project). In my company we do it that way; we have two main branches in different countries, thus two organizations. But each country have several teams, and for instance the same coder could be assigned to "devs-project1" and "devs-project34"; same for QA, etc. Only people assigned to "*-project34" can see its repos. In our case it makes more sense from the management point of view.
Author
Owner

@thestepafter commented on GitHub (Oct 10, 2019):

Huh, thank you for that explanation. I have already done a migration of our 78 repos with each customer repo grouped under the corresponding customer organization. I did this because our customers have multiple repos and I couldn't think of a better way to group them, especially for naming purposes and also give some of our customers access to their repos. Thank you again for your help on this.

@thestepafter commented on GitHub (Oct 10, 2019): Huh, thank you for that explanation. I have already done a migration of our 78 repos with each customer repo grouped under the corresponding customer organization. I did this because our customers have multiple repos and I couldn't think of a better way to group them, especially for naming purposes and also give some of our customers access to their repos. Thank you again for your help on this.
Author
Owner

@guillep2k commented on GitHub (Oct 10, 2019):

You can do that with teams. But I understand that having /yourclient in the URL has a better ring to it. 😄

@guillep2k commented on GitHub (Oct 10, 2019): You can do that with teams. But I understand that having `/yourclient` in the URL has a better ring to it. 😄
Author
Owner

@thestepafter commented on GitHub (Oct 10, 2019):

It is more about not having to put the client name in every repo name than having it in the URL. Thank you again for your assistance.

@thestepafter commented on GitHub (Oct 10, 2019): It is more about not having to put the client name in every repo name than having it in the URL. Thank you again for your assistance.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4089