Organizations

Organization API

1. List the organizations a user belongs to

Request

GET https://api.gitcode.com/api/v5/users/{username}/orgs

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
username*username(username/login)pathstring
pageCurrent Page Number,default:1querystring
per_pageItems Per Page,maximum is 100querystring

Response

[
  {
    "id": 133039,
    "login": "openharmony",
    "name": "OpenHarmony",
    "avatar_url": null,
    "repos_url": null,
    "events_url": null,
    "members_url": null,
    "description": "OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及运营的开源项目,目标是面向全场景、全连接、全智能时代,搭建一个智能终端设备操作系统的框架和平台,促进万物互联产业的繁荣发展。",
    "follow_count": 3
  }
]

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/users/user1/orgs?access_token=xxx'

2. List the organizations an authorized user belongs to

Request

GET https://api.gitcode.com/api/v5/users/orgs

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
pageCurrent Page Number,default:1querystring
per_pageItems Per Page, maximum is 100querystring
adminFilter by Admin Permissionsqueryboolean

Response

[
  {
    "id": 133039,
    "login": "openharmony",
    "path": "openharmony",
    "name": "OpenHarmony",
    "avatar_url": null,
    "repos_url": null,
    "events_url": null,
    "members_url": null,
    "description": "OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及运营的开源项目,目标是面向全场景、全连接、全智能时代,搭建一个智能终端设备操作系统的框架和平台,促进万物互联产业的繁荣发展。",
    "follow_count": 3
  }
]

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/users/orgs?access_token=xxx'

3. Get details of an organization member

Request

GET https://api.gitcode.com/api/v5/orgs/{org}/members/{username}

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Organization Path (path/login)pathstring
username*username(username/login)pathstring

Response

{
  "id": 133039,
  "path": "openharmony",
  "name": "",
  "url": "",
  "avatar_url": null,
  "user": {
    "id": "64dc3b13b8b9504cec223ab1",
    "login": "theo6789",
    "name": "TheoCui",
    "avatar_url": null,
    "html_url": "https://gitcode.com/theo6789"
  }
}

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/orgs/xiaogang_test/members/xiapgang?access_token=xxx'

4. Get information about an organization

Request

GET https://api.gitcode.com/api/v5/orgs/{org}

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Organization Path (path/login)pathstring

Response

{
  "id": 6486504,
  "login": "openharmony",
  "name": "OpenHarmony",
  "avatar_url": "",
  "repos_url": "https://api.gitcode.com/openharmony/repos",
  "events_url": "https://api.gitcode.com/openharmony/events",
  "members_url": "https://api.gitcode.com/openharmony/members{/member}",
  "description": "OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及运营的开源项目,目标是面向全场景、全连接、全智能时代,搭建一个智能终端设备操作系统的框架和平台,促进万物互联产业的繁荣发展。\r\n",
  "enterprise": "openharmony",
  "follow_count": 40819,
  "gitee": {
    "follows": 43454
  }
}

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/orgs/xiaogang_test?access_token=xxx'

5. Get the repo list of an organization

Request

GET https://api.gitcode.com/api/v5/orgs/{org}/repos

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Organization Path (path/login)pathstring
typeFilter Repository by Type, which can be: all, public, private. Default: allquerystring
pageCurrent Page Number,default:1queryint
per_pageItems Per Page, Maximum 100,default:20queryint

Response

[
  {
    "id": 29724198,
    "full_name": "openharmony/.gitee",
    "namespace": {
      "id": 6486504,
      "type": "group",
      "name": "OpenHarmony",
      "path": "openharmony",
      "html_url": "https://gitcode.com/openharmony"
    },
    "path": ".gitee",
    "name": ".gitee",
    "description": "",
    "private": false,
    "public": true,
    "internal": false,
    "fork": false,
    "html_url": "https://gitcode.com/openharmony/.gitee.git",
    "forks_count": 4,
    "stargazers_count": 0,
    "watchers_count": 1,
    "default_branch": "master",
    "open_issues_count": 0,
    "license": null,
    "project_creator": "landwind",
    "pushed_at": "2024-02-06T18:25:26+08:00",
    "created_at": "2023-06-16T10:55:42+08:00",
    "updated_at": "2024-03-29T14:59:46+08:00",
    "status": "开始"
  }
]

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/orgs/xiaogang_test/repos?access_token=xxx'

6. Create a repository for an organization

Request

POST https://api.gitcode.com/api/v5/orgs/{org}/repos

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Organization Path (path/login)pathstring
name*Repository Namebodystring
descriptionRepository Descriptionbodystring
homepagehomepagebodystring
has_issuesAllow Issues to Be Created (Enabled/Disabled). Default: truebodyboolean
has_wikiProvide Wiki (Enabled/Disabled). Default: truebodyboolean
can_commentAllow Users to Comment on Repositories. Default: truebodyboolean
publicRepository Open Source Type: 0 (Private), 1 (External Open Source), 2 (Internal Open Source). Note: This is mutually exclusive with private and is primarily based on publicbodyint
privateRepository Visibility (Public or Private). Default: Public (false) . Note: This is mutually exclusive with public and is primarily based on public.bodyboolean
auto_initIf the value is true, the repository will be initialized with a README. Default: Not Initialized (false)bodyboolean
gitignore_templategitignore templatebodystring
license_templatelicense templatebodystring
pathRepository Pathbodystring
default_branchDefault Branch Name when Initializing a Repository.Default: mainformDatastring

Response

{
  "id": 34171993,
  "full_name": "daming_1/test_create_project_2",
  "human_name": "daming/test_create_project_2",
  "url": "https://gitcode.com/api/v5/repos/daming_1/test_create_project_2",

  "path": "test_create_project_2",
  "name": "test_create_project_2",

  "description": "Description",
  "private": false,
  "public": true,
  "namespace": {
    "id": 74962,
    "name": "group1111",
    "path": "group11111",
    "develop_mode": "normal",
    "region": null,
    "cell": "default",
    "kind": "group",
    "full_path": "group11111",
    "full_name": "group1111",
    "parent_id": null,
    "visibility_level": 20,
    "enable_file_control": false,
    "owner_id": null
  },
  "empty_repo": null,
  "starred": null,
  "visibility": "public",
  "owner": null,
  "creator": null,
  "forked_from_project": null,
  "item_type": null,
  "main_repository_language": null,
  "homepage": "http://www.baidi.com"
}

Demo

curl --location -g --request POST 'https://api.gitcode.com/api/v5/orgs/xiaogang_test/repos?access_token=xxx'
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "test"
}'

7. Get a specific member of a enterprise

Request

GET https://api.gitcode.com/api/v5/enterprises/{enterprise}/members/{username}

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
enterprise*Enterprise Path(path/login)pathstring
username*username(username/login)pathstring

Response

{
  "user": {
    "avatar_url": "https://cdn-img.gitcode.com/ec/fb/430ecf07b9ee91bbbbf341d92a36783d06e69086f82ce8cf5a6406f79f1c9cf4.png",
    "html_url": "https://gitcode.com/dengmengmian",
    "id": "268",
    "login": "dengmengmian",
    "name": "dengmengmian"
  },
  "url": "https://gitcode.com/dengmengmian",
  "active": true,
  "role": "admin",
  "enterprise": {
    "id": 0,
    "url": "https://gitcode.com/dengmengmian"
  }
}

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/enterprises/go-tribe/members/dengmengmian?access_token=xxx'

8. Get the member profile of an authorized user in an organization

Request

GET https://api.gitcode.com/api/v5/user/memberships/orgs/{org}

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Enterprise Path(path/login)pathstring

Response

{
  "id": 1783195,
  "path": "Go-Tribe",
  "name": "gotribe",
  "url": "https://gitcode.com/Go-Tribe",
  "avatar_url": "https://cdn-img.gitcode.com/bb/eb/b3b4e25b54add3c80961d3ba2e3724d03998eae467c99ab898ea39e48cb1b4f6.png?time1717675394237",
  "user": {
    "id": "650d67fbae6d795139b49b41",
    "login": "dengmengmian",
    "name": "麻凡",
    "avatar_url": "https://cdn-img.gitcode.com/ec/fb/430ecf07b9ee91bbbbf341d92a36783d06e69086f82ce8cf5a6406f79f1c9cf4.png",
    "html_url": "https://gitcode.com/dengmengmian"
  },
  "active": true,
  "role": "admin",
  "organization": {
    "id": 1783195,
    "login": "Go-Tribe",
    "name": "gotribe"
  }
}

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/user/memberships/orgs/go-tribe?access_token=xxx'

9.List all members of an organization

Request

GET https://api.gitcode.com/api/v5/orgs/{org}/members

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Enterprise Path(path/login)pathstring
pageCurrent Page Number,default:1queryint
per_pageItems Per Page, Maximum 100,default:20queryint
roleFilter Members by Role(all/admin/member)querystring

Response

[
  {
    "avatar_url": "https://cdn-img.gitcode.com/ec/fb/430ecf07b9ee91bbbbf341d92a36783d06e69086f82ce8cf5a6406f79f1c9cf4.png",
    "followers_url": "https://api.gitcode.com/api/v5users/dengmengmian/followers",
    "html_url": "https://gitcode.com/dengmengmian",
    "id": "268",
    "login": "dengmengmian",
    "member_role": "admin",
    "name": "麻凡",
    "type": "User",
    "url": "https://api.gitcode.com/api/v5/dengmengmian"
  }
]

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/orgs/go-tribe/members?access_token=xxxx&page=1&pre_page=10&role=all'

10. List all members of a enterprise

Request

GET https://api.gitcode.com/api/v5/enterprises/{enterprise}/members

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Enterprise Path(path/login)pathstring
pageCurrent Page Number,default:1queryint
per_pageItems Per Page, Maximum 100,default:20queryint
roleFilter Members by Role(all/admin/member)querystring

Response

[
  {
    "user": {
      "avatar_url": "https://cdn-img.gitcode.com/ec/fb/430ecf07b9ee91bbbbf341d92a36783d06e69086f82ce8cf5a6406f79f1c9cf4.png",
      "html_url": "https://gitcode.com/dengmengmian",
      "id": "268",
      "login": "dengmengmian",
      "name": "麻凡",
      "url": "https://api.gitcode.com/api/v5/dengmengmian"
    },
    "url": "https://api.gitcode.com/api/v5/enterprises/go-tribe/members/dengmengmian",
    "active": true,
    "role": "admin"
  }
]

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/enterprises/go-tribe/members?access_token=yuBy&page=1&pre_page=10&role=all'

11. Remove a member from an organization managed by the authorized user

Request

DELETE https://api.gitcode.com/api/v5/orgs/{org}/memberships/{username}

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Organization Path (path/login)pathstring
username*username(username/login)pathstring

Response

{}

Demo

curl --location --request DELETE 'https://api.gitcode.com/api/v5/orgs/tiandi/memberships/yinlin?access_token=******'

12. List all followers of a specific organization

Request

GET https://api.gitcode.com/api/v5/orgs/{owner}/followers

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
owner*Repository Ownership Path (Company, Organization, or Personal Path)pathstring
pageCurrent Page Number,default:1queryint
per_pageItems Per Page, Maximum 100,default:20queryint

Response

[
  {
    "id": 496,
    "login": "xiaogang",
    "name": "xiaogang",
    "avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/bc/cd/6bc422546cdf276c147f267030d83a43e927fec67ca66f0b22f7e03556206fa3.jpg",
    "watch_at": "2024-11-13T16:15:53.287+08:00"
  }
]

Demo

curl --location 'https://api.gitcode.com/api/v5/orgs/xiaogang_test/followers' \
--header 'PRIVATE-TOKEN: your_token'

13. Get extended issue configuration

Request

GET https://api.gitcode.com/api/v5/orgs/{org}/issue/extend/settings

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Repository Ownership Path (Company or Organization Path)pathstring

Response

[
    {
        "type_name": "需求",
        "type_id": 4,
        "type_desc": "定义和Description产品或项目中需要实现的新功能或改进",
        "status": [
            {
                "status_name": "未提单",
                "status_id": 11,
                "status_desc": "需求尚未正式提交,仍处于概念或讨论阶段,未进入系统管理流程",
                "gitcode_issue_status": 0
            },
            ... ...
            {
                "status_name": "修复中",
                "status_id": 20,
                "status_desc": "需求的解决方案在实施过程中发现问题,正在进行修复工作",
                "gitcode_issue_status": 0
            }
        ]
    },
    ... ...
    {
        "type_name": "咨询",
        "type_id": 36138,
        "type_desc": "",
        "status": [
            {
                "status_name": "未提单",
                "status_id": 11,
                "status_desc": "需求尚未正式提交,仍处于概念或讨论阶段,未进入系统管理流程",
                "gitcode_issue_status": 0
            },
            ... ...
            {
                "status_name": "已完成",
                "status_id": 14,
                "status_desc": "需求的所有相关工作已结束,成果已交付,进入归档状态",
                "gitcode_issue_status": 1
            }
        ]
    }
]

Demo

curl --location 'https://api.gitcode.com/api/v5/orgs/openharmony/issue/extend/settings?access_token=your_token'

14. Invite an Organization Member

Request

POST https://api.gitcode.com/api/v5/orgs/{org}/memberships/{username}

Parameters

ParameterDescriptionTypeData Type
access_token*personal access tokenquerystring
org*Repository Ownership Path (Company, Organization, or Personal Path)pathstring
username*username/loginpathstring
permissionMember permissions: pull code(pull), push code(push), admin. Default: push, customized (custom role)bodystring
role_idRole ID. Required if ‘permission’ is set to ‘customized’bodystring

Response

{
  "followers_url": "https://api.gitcode.com/api/v5/users/xiaogang2/followers",
  "html_url": "https://gitcode.com/xiaogang2",
  "id": "65ffca965079ba0d1c00f6f2",
  "login": "xiaogang2",
  "name": "肖刚2",
  "type": "User",
  "url": "https://api.gitcode.com/api/v5/xiaogang2",
  "permissions": {
    "admin": false,
    "customized": true,
    "push": true,
    "pull": true
  }
}

Demo

curl --location POST 'https://api.gitcode.com/api/v5/orgs/xiaogang_test/memberships/xiaogang2?access_toke=?' \
--data '{
    "permission":"push"
    }'

15. Modify Enterprise Member Permissions

Request

PUT https://api.gitcode.com/api/v5/enterprises/{enterprise}/members/{username}

Parameters

ParameterDescriptionTypeData Type
access token*Personal access tokenquerystring
enterprise*Repository Owner Path (Organization or User Path)pathstring
username*Username (username/login)pathstring
role*Enterprise role (viewer、 tester、 developer、 maintainer、 admin)bodystring

Response

{
    "active": true,
    "role": "member",
    "url": "https://api.gitcode.com/api/v5/enterprises/litestabc/members/malongge5",
    "user": {
        "id": 953,
        "login": "malongge5",
        "url": "https://api.gitcode.com/api/v5/malongge5",
        "html_url": "https://gitcode.com/malongge5"
    }
}

Demo

curl --location --request PUT 'https://api.gitcode.com/api/v5/enterprises/litestabc/members/malongge5?access_token=?' \
--header 'Content-Type: application/json' \
--data-raw '{"role":"developer"}'