组织公告横幅的 REST API 终结点
使用组织公告横幅 API,可以获取、设置和删除组织的公告横幅。
Get announcement banner for organization
Gets the announcement banner currently set for the organization. Only returns the announcement banner set at the organization level. Organization members may also see an enterprise-level announcement banner. To get an announcement banner displayed at the enterprise level, use the enterprise-level endpoint.
“Get announcement banner for organization”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Organization announcement banners" organization permissions (read)
“Get announcement banner for organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
“Get announcement banner for organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get announcement banner for organization”的示例代码
如果你通过 GHE.com 访问 GitHub,请将 api.github.com
替换为你的企业在 api.SUBDOMAIN.ghe.com
上的专用子域。
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/announcement
Announcement banner
Set announcement banner for organization
Sets the announcement banner to display for the organization.
“Set announcement banner for organization”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Organization announcement banners" organization permissions (write)
“Set announcement banner for organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
名称, 类型, 说明 |
---|
announcement string or null 必须The announcement text in GitHub Flavored Markdown. For more information about GitHub Flavored Markdown, see "Basic writing and formatting syntax." |
expires_at string or null The time at which the announcement expires. This is a timestamp in ISO 8601 format: |
“Set announcement banner for organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Set announcement banner for organization”的示例代码
如果你通过 GHE.com 访问 GitHub,请将 api.github.com
替换为你的企业在 api.SUBDOMAIN.ghe.com
上的专用子域。
请求示例
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/announcement \
-d '{"announcement":"Very **important** announcement about _something_.","expires_at":"2021-01-01T00:00:00.000+00:00","user_dismissible":false}'
Announcement banner
Remove announcement banner from organization
Removes the announcement banner currently set for the organization.
“Remove announcement banner from organization”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Organization announcement banners" organization permissions (write)
“Remove announcement banner from organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
“Remove announcement banner from organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | No Content |
“Remove announcement banner from organization”的示例代码
如果你通过 GHE.com 访问 GitHub,请将 api.github.com
替换为你的企业在 api.SUBDOMAIN.ghe.com
上的专用子域。
请求示例
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/announcement
Response
Status: 204