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

Create project

POST/api/projects
Thành viên đã đăng nhập

Đọc hướng dẫnMã nguồn: ProjectApiController#create(mở trong thẻ mới)

Request body​

application/json

TrườngKiểuBắt buộcGhi chú
namestringBắt buộcmax 120

Response​

Thành công: 201

TrườngKiểuBắt buộcGhi chú
idstring (uuid)Tùy chọn
namestringTùy chọn
createdAtstring (date-time)Tùy chọn
sourcesarray of IntegrationSourceViewTùy chọn
sources[].idstring (uuid)Tùy chọn
sources[].typeenum SourceTypeTùy chọnGITHUBGITLABLINEARJIRA
sources[].deliveryMechanismstringTùy chọn
sources[].externalProjectKeystringTùy chọn
sources[].externalTeamKeystringTùy chọn
sources[].ownerstringTùy chọn
sources[].repositorystringTùy chọn
sources[].apiBaseUrlstringTùy chọn
sources[].externalWorkspaceKeystringTùy chọn
sources[].credentialIdentitystringTùy chọn
sources[].webhookAuthModeenum WebhookAuthModeTùy chọnGITHUB_HMACGITLAB_SIGNING_TOKENGITLAB_SECRET_TOKENLINEAR_HMACNONE
sources[].webhookIdstring (uuid)Tùy chọn
sources[].webhookPathstringTùy chọn
sources[].createdAtstring (date-time)Tùy chọn
sources[].lastDeliveryAtstring (date-time)Tùy chọn
sources[].accessTokenConfiguredbooleanTùy chọn
sources[].accessTokenUpdatedAtstring (date-time)Tùy chọn
sources[].connectionStatusenum ConnectionStatusTùy chọnACTIVEERRORDISCONNECTED
sources[].lastSyncAtstring (date-time)Tùy chọn
sources[].lastErrorCodestringTùy chọn
sources[].nextPollAtstring (date-time)Tùy chọn
sources[].healthSourceHealthTù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
400gitlab_base_url_invalidKhu vực Sources
400gitlab_host_not_allowedKhu vực Sources
400jira_site_invalidKhu vực Sources
400github_token_rejectedKhu vực Sources
400gitlab_token_rejectedKhu vực Sources
400linear_token_rejectedKhu vực Sources
400jira_token_rejectedKhu vực Sources
400source_credential_requiredKhu vực Sources
400source_signing_token_invalidKhu vực Sources
404project_not_foundKhu vực Sources
404source_not_foundKhu vực Sources
409github_repository_already_connectedKhu vực Sources
409gitlab_project_already_connectedKhu vực Sources
409linear_team_already_connectedKhu vực Sources
409jira_project_already_connectedKhu vực Sources
409source_token_missingKhu vực Sources
409source_sync_in_progressKhu vực Sources
409source_import_not_supportedKhu vực Sources
409source_import_not_resumableKhu vực Sources
409source_disconnectedKhu vực Sources
409source_not_disconnectedKhu vực Sources
409source_reconnect_requiredKhu vực Sources
409source_has_no_webhookKhu vực Sources
409source_secret_generatedKhu vực Sources
409source_secret_pastedKhu vực Sources
503github_unavailableKhu vực Sources
503gitlab_unavailableKhu vực Sources
503jira_unavailableKhu vực Sources

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/projects" \
-b cookies.txt -c cookies.txt \
-H "$CSRF_HEADER: $CSRF_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"name": "<string>"
}'

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

Response

201

Ví dụ

{
  "id": "<uuid>",
  "name": "<string>",
  "createdAt": "<date-time>",
  "sources": [
    {
      "id": "<uuid>",
      "type": "GITHUB",
      "deliveryMechanism": "<string>",
      "externalProjectKey": "<string>",
      "externalTeamKey": "<string>",
      "owner": "<string>",
      "repository": "<string>",
      "apiBaseUrl": "<string>",
      "externalWorkspaceKey": "<string>",
      "credentialIdentity": "<string>",
      "webhookAuthMode": "GITHUB_HMAC",
      "webhookId": "<uuid>",
      "webhookPath": "<string>",
      "createdAt": "<date-time>",
      "lastDeliveryAt": "<date-time>",
      "accessTokenConfigured": false,
      "accessTokenUpdatedAt": "<date-time>",
      "connectionStatus": "ACTIVE",
      "lastSyncAt": "<date-time>",
      "lastErrorCode": "<string>",
      "nextPollAt": "<date-time>",
      "health": {
        "connected": false,
        "disconnectedAt": "<date-time>",
        "secretUpdatedAt": "<date-time>",
        "signatureFailureCount": 0,
        "lastSignatureFailureAt": "<date-time>",
        "quiet": false,
        "quietSince": "<date-time>",
        "usualGapHours": 0,
        "overdue": false
      }
    }
  ]
}