Create audience
POST
/api/audiencesQuản trị viên
Request body
application/json
| Trường | Kiểu | Bắt buộc | Ghi chú |
|---|---|---|---|
displayName | string | Bắt buộc | max 120 |
communicationIntent | string | Tùy chọn | max 1000 |
templateBody | string | Tùy chọn | |
footerTemplateBody | string | Tùy chọn | |
code | string | Bắt buộc | max 64 · pattern [a-z][a-z0-9_]* |
Response
Thành công: 201
| Trường | Kiểu | Bắt buộc | Ghi chú |
|---|---|---|---|
id | string (uuid) | Tùy chọn | |
code | string | Tùy chọn | |
displayName | string | Tùy chọn | |
communicationIntent | string | Tùy chọn | |
templateBody | string | Tùy chọn | |
footerTemplateBody | string | Tùy chọn | |
preset | boolean | Tùy chọn | |
createdAt | string (date-time) | Tùy chọn | |
updatedAt | string (date-time) | Tùy chọn | |
templateVariants | map of string | Tùy chọn | |
footerTemplateVariants | map of string | Tùy chọn | |
retiredAt | string (date-time) | Tùy chọn | |
retirerName | string | Tùy chọn |
Lỗi
| Trạng thái | Mã | Áp dụng cho |
|---|---|---|
400 | validation_failedthiếu trường hoặc giá trị nằm ngoài khoảng cho phép | Mọi endpoint |
400 | malformed_requestkhông đọc được body | Mọi endpoint |
400 | invalid_parametermột tham số trên đường dẫn hoặc query bị thiếu hoặc không chuyển đổi được, chẳng hạn một ID không phải UUID | Mọi endpoint |
401 | authentication_requiredchưa có phiên đăng nhập | Mọi endpoint |
403 | access_deniedendpoint dành cho quản trị viên, hoặc CSRF token thiếu hay đã cũ | Mọi endpoint |
404 | not_foundkhông có địa chỉ đó | Mọi endpoint |
405 | method_not_allowedđịa chỉ không nhận phương thức đó | Mọi endpoint |
415 | unsupported_media_typeđịa chỉ không đọc body thuộc kiểu đó | Mọi endpoint |
500 | internal_errormột lỗi ReleaseFlow không lường trước; body không bao giờ chứa exception gây ra nó | Mọi endpoint |
400 | template_invalid | Khu vực Audiences |
400 | template_narratives_path | Khu vực Audiences |
400 | template_language_not_targeted | Khu vực Audiences |
400 | invalid_release_languages | Khu vực Audiences |
404 | audience_not_found | Khu vực Audiences |
409 | audience_code_taken | Khu vực Audiences |
409 | audience_limit | Khu vực Audiences |
409 | audience_last | Khu vực Audiences |
409 | audience_last_active | Khu vực Audiences |
409 | audience_already_retired | Khu vực Audiences |
409 | audience_not_retired | Khu vực Audiences |
409 | audience_in_use | Khu vực Audiences |
409 | audience_not_preset | Khu vực Audiences |
404 | glossary_term_not_found | Khu vực Glossary |
409 | glossary_term_taken | Khu vực Glossary |
409 | glossary_limit | Khu vực Glossary |
400 | invalid_release_schedule | Khu vực Releases |
400 | invalid_upgrade_guide_url | Khu vực Releases |
400 | invalid_previous_release | Khu vực Releases |
400 | invalid_fold_decision | Khu vực Releases |
404 | release_not_found | Khu vực Releases |
404 | release_note_not_found | Khu vực Releases |
404 | folding_suggestion_not_found | Khu vực Releases |
404 | linked_issue_not_found | Khu vực Releases |
409 | release_status_conflict | Khu vực Releases |
409 | release_published | Khu vực Releases |
409 | release_empty | Khu vực Releases |
409 | release_review_incomplete | Khu vực Releases |
409 | change_summary_required | Khu vực Releases |
409 | release_version_taken | Khu vực Releases |
409 | classification_changed | Khu vực Releases |
409 | change_not_releasable | Khu vực Releases |
409 | change_excluded | Khu vực Releases |
409 | release_note_render_failed | Khu vực Releases |
409 | release_notes_missing | Khu vực Releases |
409 | translations_not_ready | Khu vực Releases |
409 | linked_issue_status_changed | Khu vực Releases |
Request
bash
# Sign in first and keep the session cookie in cookies.txt (see Sessions and CSRF).
# CSRF_HEADER and CSRF_TOKEN are the headerName and token GET /api/csrf returned.
curl -X POST "http://localhost:8080/api/audiences" \
-b cookies.txt -c cookies.txt \
-H "$CSRF_HEADER: $CSRF_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"displayName": "<string>",
"communicationIntent": "<string>",
"templateBody": "<string>",
"footerTemplateBody": "<string>",
"code": "<string>"
}'
Request body là ví dụ dựng từ schema; thay mọi giá trị giữ chỗ trước khi gửi.
Response
201Ví dụ
{
"id": "<uuid>",
"code": "<string>",
"displayName": "<string>",
"communicationIntent": "<string>",
"templateBody": "<string>",
"footerTemplateBody": "<string>",
"preset": false,
"createdAt": "<date-time>",
"updatedAt": "<date-time>",
"templateVariants": {
"<key>": "<string>"
},
"footerTemplateVariants": {
"<key>": "<string>"
},
"retiredAt": "<date-time>",
"retirerName": "<string>"
}