Chuyển tới nội dung chính

Update template

PUT/api/audiences/{audienceId}/templates/{language}
Quản trị viên

Mỗi audience có template riêng cho từng ngôn ngữ release note mà ngôn ngữ đầu ra không bao phủ, được tạo khi thêm ngôn ngữ hoặc thêm audience: một audience mẫu bắt đầu từ template đi kèm của nó bằng ngôn ngữ đó, với các nhãn đã dịch, còn mọi audience khác bắt đầu từ bản sao template chính của nó. Sửa chúng trong mục Template theo ngôn ngữ trên trang của audience, hoặc gọi PUT /api/audiences/{audienceId}/templates/{language}. Đặt lại một audience mẫu cũng đặt lại các template này.

Đọc thêm: Ngôn ngữ release noteMã nguồn: AudienceApiController#updateTemplate(mở trong thẻ mới)

Tham số đường dẫn​

TênKiểuBắt buộcGhi chú
audienceIdstring (uuid)Bắt buộc
languagestringBắt buộc

Request body​

application/json

TrườngKiểuBắt buộcGhi chú
templateBodystringTùy chọn
footerTemplateBodystringTùy chọn

Response​

Thành công: 200

TrườngKiểuBắt buộcGhi chú
idstring (uuid)Tùy chọn
codestringTùy chọn
displayNamestringTùy chọn
communicationIntentstringTùy chọn
templateBodystringTùy chọn
footerTemplateBodystringTùy chọn
presetbooleanTùy chọn
createdAtstring (date-time)Tùy chọn
updatedAtstring (date-time)Tùy chọn
templateVariantsmap of stringTùy chọn
footerTemplateVariantsmap of stringTùy chọn
retiredAtstring (date-time)Tùy chọn
retirerNamestringTùy chọn

Lỗi​

Trạng tháiMãÁp dụng cho
400validation_failedthiếu trường hoặc giá trị nằm ngoài khoảng cho phépMọi endpoint
400malformed_requestkhông đọc được bodyMọi endpoint
400invalid_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 UUIDMọi endpoint
401authentication_requiredchưa có phiên đăng nhậpMọi endpoint
403access_deniedendpoint dành cho quản trị viên, hoặc CSRF token thiếu hay đã cũMọi endpoint
404not_foundkhông có địa chỉ đóMọi endpoint
405method_not_allowedđịa chỉ không nhận phương thức đóMọi endpoint
415unsupported_media_typeđịa chỉ không đọc body thuộc kiểu đóMọi endpoint
500internal_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
400template_invalidKhu vực Audiences
400template_narratives_pathKhu vực Audiences
400template_language_not_targetedKhu vực Audiences
400invalid_release_languagesKhu vực Audiences
404audience_not_foundKhu vực Audiences
409audience_code_takenKhu vực Audiences
409audience_limitKhu vực Audiences
409audience_lastKhu vực Audiences
409audience_last_activeKhu vực Audiences
409audience_already_retiredKhu vực Audiences
409audience_not_retiredKhu vực Audiences
409audience_in_useKhu vực Audiences
409audience_not_presetKhu vực Audiences
404glossary_term_not_foundKhu vực Glossary
409glossary_term_takenKhu vực Glossary
409glossary_limitKhu vực Glossary
400invalid_release_scheduleKhu vực Releases
400invalid_upgrade_guide_urlKhu vực Releases
400invalid_previous_releaseKhu vực Releases
400invalid_fold_decisionKhu vực Releases
404release_not_foundKhu vực Releases
404release_note_not_foundKhu vực Releases
404folding_suggestion_not_foundKhu vực Releases
404linked_issue_not_foundKhu vực Releases
409release_status_conflictKhu vực Releases
409release_publishedKhu vực Releases
409release_emptyKhu vực Releases
409release_review_incompleteKhu vực Releases
409change_summary_requiredKhu vực Releases
409release_version_takenKhu vực Releases
409classification_changedKhu vực Releases
409change_not_releasableKhu vực Releases
409change_excludedKhu vực Releases
409release_note_render_failedKhu vực Releases
409release_notes_missingKhu vực Releases
409translations_not_readyKhu vực Releases
409linked_issue_status_changedKhu 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 PUT "http://localhost:8080/api/audiences/$AUDIENCE_ID/templates/$LANGUAGE" \
-b cookies.txt -c cookies.txt \
-H "$CSRF_HEADER: $CSRF_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"templateBody": "<string>",
"footerTemplateBody": "<string>"
}'

Request body là ví dụ dựng từ schema; thay mọi giá trị giữ chỗ trước khi gửi.

Response

200

Ví 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>"
}