289.md 3.4 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
# Appearance API

> 原文:[https://docs.gitlab.com/ee/api/appearance.html](https://docs.gitlab.com/ee/api/appearance.html)

*   [Get current appearance configuration](#get-current-appearance-configuration)
*   [Change appearance configuration](#change-appearance-configuration)

# Appearance API[](#appearance-api-core-only "Permalink")

在 GitLab 12.7 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/16647) .

Appearance API 使您可以像在`/admin/appearance`使用 GitLab UI 一样维护 GitLab 的`/admin/appearance` . 该 API 需要管理员权限.

## Get current appearance configuration[](#get-current-appearance-configuration "Permalink")

列出 GitLab 实例的当前外观配置.

```
GET /application/appearance 
```

```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/application/appearance" 
```

响应示例:

```
{  "title":  "GitLab Test Instance",  "description":  "gitlab-test.example.com",  "logo":  "/uploads/-/system/appearance/logo/1/logo.png",  "header_logo":  "/uploads/-/system/appearance/header_logo/1/header.png",  "favicon":  "/uploads/-/system/appearance/favicon/1/favicon.png",  "new_project_guidelines":  "Please read the FAQs for help.",  "profile_image_guidelines":  "Custom profile image guidelines",  "header_message":  "",  "footer_message":  "",  "message_background_color":  "#e75e40",  "message_font_color":  "#ffffff",  "email_header_and_footer_enabled":  false  } 
```

## Change appearance configuration[](#change-appearance-configuration "Permalink")

使用 API​​调用来修改 GitLab 实例外观配置.

```
PUT /application/appearance 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | no | 登录/注册页面上的实例标题 |
| `description` | string | no | 降价文字显示在登录/注册页面上 |
| `logo` | mixed | no | 登录/注册页面上使用的实例图像 |
| `header_logo` | mixed | no | 用于主导航栏的实例图像 |
| `favicon` | mixed | no | `.ico``.png`格式的实例图标 |
| `new_project_guidelines` | string | no | 新项目页面上显示的降价文字 |
| `profile_image_guidelines` | string | no | 降价文字显示在个人头像下方的个人资料页面上 |
| `header_message` | string | no | 系统标题栏中的消息 |
| `footer_message` | string | no | 系统页脚栏中的消息 |
| `message_background_color` | string | no | 系统页眉/页脚栏的背景颜色 |
| `message_font_color` | string | no | 系统页眉/页脚栏的字体颜色 |
| `email_header_and_footer_enabled` | boolean | no | 如果启用,则在所有外发电子邮件中添加页眉和页脚 |

```
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/application/appearance?email_header_and_footer_enabled=true&header_message=test" 
```

响应示例:

```
{  "title":  "GitLab Test Instance",  "description":  "gitlab-test.example.com",  "logo":  "/uploads/-/system/appearance/logo/1/logo.png",  "header_logo":  "/uploads/-/system/appearance/header_logo/1/header.png",  "favicon":  "/uploads/-/system/appearance/favicon/1/favicon.png",  "new_project_guidelines":  "Please read the FAQs for help.",  "profile_image_guidelines":  "Custom profile image guidelines",  "header_message":  "test",  "footer_message":  "",  "message_background_color":  "#e75e40",  "message_font_color":  "#ffffff",  "email_header_and_footer_enabled":  true  } 
```