Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
9d4af1b1
Commit
9d4af1b1
authored
Aug 30, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add BroadcastMessage API documentation
parent
6a58af3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
158 additions
and
0 deletions
+158
-0
doc/api/broadcast_messages.md
doc/api/broadcast_messages.md
+158
-0
No files found.
doc/api/broadcast_messages.md
0 → 100644
View file @
9d4af1b1
# Broadcast Messages
> **Note:** This feature was introduced in GitLab 8.12.
The broadcast message API is only accessible to administrators. All requests by
guests will respond with
`401 Unauthorized`
, and all requests by normal users
will respond with
`403 Forbidden`
.
## Get all broadcast messages
```
GET /broadcast_messages
```
```
bash
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/broadcast_messages
```
Example response:
```
json
[
{
"message"
:
"Example broadcast message"
,
"starts_at"
:
"2016-08-24T23:21:16.078Z"
,
"ends_at"
:
"2016-08-26T23:21:16.080Z"
,
"color"
:
"#E75E40"
,
"font"
:
"#FFFFFF"
,
"id"
:
1
,
"active"
:
false
}
]
```
## Get a specific broadcast message
```
GET /broadcast_messages/:id
```
| Attribute | Type | Required | Description |
| ----------- | -------- | -------- | ------------------------- |
|
`id`
| integer | yes | Broadcast message ID |
```
bash
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/broadcast_messages/1
```
Example response:
```
json
{
"message"
:
"Deploy in progress"
,
"starts_at"
:
"2016-08-24T23:21:16.078Z"
,
"ends_at"
:
"2016-08-26T23:21:16.080Z"
,
"color"
:
"#cecece"
,
"font"
:
"#FFFFFF"
,
"id"
:
1
,
"active"
:
false
}
```
## Create a broadcast message
Responds with
`400 Bad request`
when the
`message`
parameter is missing or the
`color`
or
`font`
values are invalid, and
`201 Created`
when the broadcast
message was successfully created.
```
POST /broadcast_messages
```
| Attribute | Type | Required | Description |
| ----------- | -------- | -------- | ---------------------------------------------------- |
|
`message`
| string | yes | Message to display |
|
`starts_at`
| datetime | no | Starting time (defaults to current time) |
|
`ends_at`
| datetime | no | Ending time (defaults to one hour from current time) |
|
`color`
| string | no | Background color hex code |
|
`font`
| string | no | Foreground color hex code |
```
bash
curl
--data
"message=Deploy in progress&color=#cecece"
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/broadcast_messages
```
Example response:
```
json
{
"message"
:
"Deploy in progress"
,
"starts_at"
:
"2016-08-26T00:41:35.060Z"
,
"ends_at"
:
"2016-08-26T01:41:35.060Z"
,
"color"
:
"#cecece"
,
"font"
:
"#FFFFFF"
,
"id"
:
1
,
"active"
:
true
}
```
## Update a broadcast message
```
PUT /broadcast_messages/:id
```
| Attribute | Type | Required | Description |
| ----------- | -------- | -------- | ------------------------- |
|
`id`
| integer | yes | Broadcast message ID |
|
`message`
| string | no | Message to display |
|
`starts_at`
| datetime | no | Starting time |
|
`ends_at`
| datetime | no | Ending time |
|
`color`
| string | no | Background color hex code |
|
`font`
| string | no | Foreground color hex code |
```
bash
curl
--request
PUT
--data
"message=Update message&color=#000"
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/broadcast_messages/1
```
Example response:
```
json
{
"message"
:
"Update message"
,
"starts_at"
:
"2016-08-26T00:41:35.060Z"
,
"ends_at"
:
"2016-08-26T01:41:35.060Z"
,
"color"
:
"#000"
,
"font"
:
"#FFFFFF"
,
"id"
:
1
,
"active"
:
true
}
```
## Delete a broadcast message
```
DELETE /broadcast_messages/:id
```
| Attribute | Type | Required | Description |
| ----------- | -------- | -------- | ------------------------- |
|
`id`
| integer | yes | Broadcast message ID |
```
bash
curl
--request
DELETE
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/broadcast_messages/1
```
Example response:
```
json
{
"message"
:
"Update message"
,
"starts_at"
:
"2016-08-26T00:41:35.060Z"
,
"ends_at"
:
"2016-08-26T01:41:35.060Z"
,
"color"
:
"#000"
,
"font"
:
"#FFFFFF"
,
"id"
:
1
,
"active"
:
true
}
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment