跳转至

获取企业自定义角色

GET /api/v8/enterprise/{enterprise_id}/customized_roles

用户调用此接口,进行获取企业自定义角色操作.

访问令牌支持说明

  • AtomGit 用户访问令牌(AtomGit user access tokens)

是否允许匿名访问

此接口允许匿名访问

请求参数

参数名 位置 类型 必填 说明
enterprise_id path string 是 企业id
access_token query string 否 用户授权码

响应参数

响应体为自定义角色对象数组(array),每个数组元素包含以下字段:

字段 类型 必返 可为空 说明
id string 是 — 角色ID
name string 是 — 角色名称
name_cn string 是 — 角色中文名称
product_id string 是 — 产品ID
access_level integer 是 — 访问级别
created_at string 是 — 创建时间
role_type string 是 — 角色类型
updated_at string 是 — 更新时间
description string 是 — 角色描述
mgnt_mode integer 是 — 管理模式
member_count integer 是 — 成员数量

失败响应

该接口无业务失败响应。

HTTP 响应状态码

状态码 说明
200 成功(OK)

请求示例

参数说明

<enterprise_id> 替换为企业ID; 此接口允许匿名访问,也可携带 AtomGit 用户访问令牌(可选,在 URL 中追加 ?access_token=<token>)。

cURL

curl -X GET 'https://api.atomgit.com/api/v8/enterprise/<enterprise_id>/customized_roles' \
  -H 'Accept: application/json'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v8/enterprise/<enterprise_id>/customized_roles", {
  headers: {
    "Accept": "application/json",
  },
});

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v8/enterprise/<enterprise_id>/customized_roles",
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

响应示例

状态码: 200

[
  {
    "id": "string",
    "name": "string",
    "name_cn": "string",
    "product_id": "string",
    "access_level": 0,
    "created_at": "string",
    "role_type": "string",
    "updated_at": "string",
    "description": "string",
    "mgnt_mode": 0,
    "member_count": 0
  }
]

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc