Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have only full name in api organization model object. #21205

Closed
ozgurceozturkce opened this issue Sep 18, 2022 · 7 comments
Closed

Have only full name in api organization model object. #21205

ozgurceozturkce opened this issue Sep 18, 2022 · 7 comments
Labels

Comments

@ozgurceozturkce
Copy link

ozgurceozturkce commented Sep 18, 2022

Description

In the api models, there is no field other than the "full_name" field in the object that represents the organizations. This "full_name" field refers to the "Organization Full Name" field in the organization settings. However, the information requested in API queries is the information in the "Organization Name" field. And this information is one that cannot be retrieved with the current api model.

Ekran görüntüsü 2022-09-19 015910

Ekran görüntüsü 2022-09-19 002620

This causes an error in requests like "/orgs/{org}/hooks", "/orgs/{org}/members" etc if organization name and display name are different.

For example, if the organization name is Microsoft, the address of the request should be "/orgs/Microsoft/members", but since the organization's full name is Microsoft Inc, the address will be "/orgs/Microsoft%20Inc/members" and the response is as follows as an example.

{
  "errors": [
    "user redirect does not exist [name: microsoft inc]"
  ],
  "message": "GetOrgByName",
  "url": "https://try.gitea.io/api/swagger"
}

Gitea Version

1.17.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Git Version

No response

Operating System

Windows Server 2022

How are you running Gitea?

Gitea binary applicaiton on Windows server with default configurations.

Database

MySQL

@KN4CK3R
Copy link
Member

KN4CK3R commented Sep 18, 2022

username should contain the value.

@ozgurceozturkce
Copy link
Author

KN4CK3R, username is not available in organization api model. Where exactly should I put a username?

@KN4CK3R
Copy link
Member

KN4CK3R commented Sep 19, 2022

It's in your screenshot. Third from bottom.

grafik

You don't call the API with the display name but the username.

grafik

@ozgurceozturkce
Copy link
Author

This is exactly what I was looking for. Thank you. But this information is not available in the documentation. As is known, there is no "username" field among model members in the documentation. In any case, I got my answer. Thanks for your attention. I'm closing the issue.

@KN4CK3R
Copy link
Member

KN4CK3R commented Sep 19, 2022

Which documentation are you talking about?

@ozgurceozturkce
Copy link
Author

I'm sorry for the late reply.
What I want to say is the lack of information. Since the object name is "organization" and the field name is "username", I think it would be more understandable if there was a description text or if the field name was like "name" or "org_name" instead of "username". Please don't get me wrong, I'm not saying to do it like this (write documentation) it's just my opinion. That's why I opened such an issue. Thanks for your understanding and help.

@KN4CK3R
Copy link
Member

KN4CK3R commented Sep 20, 2022

Org and user model are the same internally, so that may be reason. I would like to say "it's the same as GitHub does" but they named the field just name. May be changed in the future. 🤷‍♂️

6543 pushed a commit that referenced this issue Sep 29, 2022
related #21205

The field `UserName` is not really usefull for an organization.
This adds a second `Name` field.

The [GitHub API](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) uses `name` too. `UserName` should be deprecated then.
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants