Skip to content

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

@ozgurceozturkce

Description

@ozgurceozturkce

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

Activity

KN4CK3R

KN4CK3R commented on Sep 18, 2022

@KN4CK3R
Member

username should contain the value.

ozgurceozturkce

ozgurceozturkce commented on Sep 18, 2022

@ozgurceozturkce
Author

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

KN4CK3R

KN4CK3R commented on Sep 19, 2022

@KN4CK3R
Member

It's in your screenshot. Third from bottom.

grafik

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

grafik

ozgurceozturkce

ozgurceozturkce commented on Sep 19, 2022

@ozgurceozturkce
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

KN4CK3R commented on Sep 19, 2022

@KN4CK3R
Member

Which documentation are you talking about?

ozgurceozturkce

ozgurceozturkce commented on Sep 20, 2022

@ozgurceozturkce
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

KN4CK3R commented on Sep 20, 2022

@KN4CK3R
Member

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. 🤷‍♂️

added a commit that references this issue on Sep 29, 2022
locked and limited conversation to collaborators on May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @KN4CK3R@ozgurceozturkce

        Issue actions

          Have only full name in api organization model object. · Issue #21205 · go-gitea/gitea