本文へ移動
Bounty Developer

POST/api/v1/boshu/calls/{id}/questionnaire/apply

「BOSHU の外部 API」の分類の、新しく作る、または操作を実行するために内容を送る API。ログインした本人として呼ぶ。

要約

操作の列を 1 つの transaction で当てる(下書きは全部・公開中と締切済みは版が増えない操作だけ。公開の状態は変えない)

呼び方と印

ログイン・レート制限

短い時間に呼びすぎると断られる API(レート制限)。断られたら Retry-After の秒数を待って呼び直す。

URL に付ける値(パラメータ)

経路の中の波かっこの部分と、URL の ? の後ろに付ける値。「必須」の印があるものは省けない。

  • idpath必須string(uuid)

送るもの(本文)application/json

送る本文の欄。「必須」の印がある欄は省けない。

  • expectedHash必須string
    /^[0-9a-f]{64}$/
  • operations必須array<object | object | object | object | object | object | object | object>
    件数 1–20
  • |1必須object
  • op必須"place"
  • moduleId必須string(uuid)
  • at任意integer
    0–20
  • |2必須object
  • op必須"add_inline"
  • body必須object
  • title必須string
    長さ 1–80
  • help任意string | null
    長さ ≤400
  • questions必須array<object>
    件数 ≤60
  • id必須string
    /^q_[a-z0-9]{4,24}$/
  • type必須enum(9)
    • "short"
    • "long"
    • "single"
    • "multi"
    • "check"
    • "url"
    • "date"
    • "image"
    • "document"
  • label必須string
    長さ 1–120
  • help任意string | null
    長さ ≤1000
  • required任意boolean
    既定 false
  • enabled任意boolean
  • options任意array<object>
    件数 ≤20 · 既定 []
  • sensitive任意boolean
    既定 false
  • maxLength任意integer
    1–2000
  • section任意string
    長さ 1–80
  • organizationField任意enum(11)
    • "name"
    • "nameKana"
    • "organizationType"
    • "baseUniversities"
    • "foundedYearMonth"
    • "memberCount"
    • "studentMemberCount"
    • "genres"
    • "links"
    • "catchphrase"
    • "activitySummary"
  • profileField任意enum(9)
    • "displayName"
    • "title"
    • "orgName"
    • "schoolName"
    • "gradYear"
    • "organizations"
    • "faculty"
    • "standing"
    • "grade"
  • memberSelection任意object
  • kind必須"active_student"
  • min必須1
  • max必須3
  • condition任意object
  • questionId必須string
    /^q_[a-z0-9]{4,24}$/
  • optionId必須string
    /^o_[a-z0-9]{1,24}$/
  • at任意integer
    0–20
  • |3必須object
  • op必須"edit_inline"
  • refId必須string
    長さ 1–40
  • body必須object
  • title必須string
    長さ 1–80
  • help任意string | null
    長さ ≤400
  • questions必須array<object>
    件数 ≤60
  • id必須string
    /^q_[a-z0-9]{4,24}$/
  • type必須enum(9)
    • "short"
    • "long"
    • "single"
    • "multi"
    • "check"
    • "url"
    • "date"
    • "image"
    • "document"
  • label必須string
    長さ 1–120
  • help任意string | null
    長さ ≤1000
  • required任意boolean
    既定 false
  • enabled任意boolean
  • options任意array<object>
    件数 ≤20 · 既定 []
  • sensitive任意boolean
    既定 false
  • maxLength任意integer
    1–2000
  • section任意string
    長さ 1–80
  • organizationField任意enum(11)
    • "name"
    • "nameKana"
    • "organizationType"
    • "baseUniversities"
    • "foundedYearMonth"
    • "memberCount"
    • "studentMemberCount"
    • "genres"
    • "links"
    • "catchphrase"
    • "activitySummary"
  • profileField任意enum(9)
    • "displayName"
    • "title"
    • "orgName"
    • "schoolName"
    • "gradYear"
    • "organizations"
    • "faculty"
    • "standing"
    • "grade"
  • memberSelection任意object
  • kind必須"active_student"
  • min必須1
  • max必須3
  • condition任意object
  • questionId必須string
    /^q_[a-z0-9]{4,24}$/
  • optionId必須string
    /^o_[a-z0-9]{1,24}$/
  • |4必須object
  • op必須"fork"
  • refId必須string
    長さ 1–40
  • body任意object
  • title必須string
    長さ 1–80
  • help任意string | null
    長さ ≤400
  • questions必須array<object>
    件数 ≤60
  • id必須string
    /^q_[a-z0-9]{4,24}$/
  • type必須enum(9)
    • "short"
    • "long"
    • "single"
    • "multi"
    • "check"
    • "url"
    • "date"
    • "image"
    • "document"
  • label必須string
    長さ 1–120
  • help任意string | null
    長さ ≤1000
  • required任意boolean
    既定 false
  • enabled任意boolean
  • options任意array<object>
    件数 ≤20 · 既定 []
  • sensitive任意boolean
    既定 false
  • maxLength任意integer
    1–2000
  • section任意string
    長さ 1–80
  • organizationField任意enum(11)
    • "name"
    • "nameKana"
    • "organizationType"
    • "baseUniversities"
    • "foundedYearMonth"
    • "memberCount"
    • "studentMemberCount"
    • "genres"
    • "links"
    • "catchphrase"
    • "activitySummary"
  • profileField任意enum(9)
    • "displayName"
    • "title"
    • "orgName"
    • "schoolName"
    • "gradYear"
    • "organizations"
    • "faculty"
    • "standing"
    • "grade"
  • memberSelection任意object
  • kind必須"active_student"
  • min必須1
  • max必須3
  • condition任意object
  • questionId必須string
    /^q_[a-z0-9]{4,24}$/
  • optionId必須string
    /^o_[a-z0-9]{1,24}$/
  • |5必須object
  • op必須"refresh"
  • refId必須string
    長さ 1–40
  • |6必須object
  • op必須"remove"
  • refId必須string
    長さ 1–40
  • |7必須object
  • op必須"shelve"
  • refId必須string
    長さ 1–40
  • key必須string
    /^m_[a-z0-9_]{2,40}$/
  • platform必須boolean
  • alsoTickets必須boolean
  • |8必須object
  • op必須"split"
  • refId必須string
    長さ 1–40
  • parts必須array<object>
    件数 2–20
  • title必須string
    長さ 1–80
  • help任意string | null
    長さ ≤400
  • questionIds必須array<string>
    件数 1–30

返るもの(応答)200 · application/json

成功したときに返る形。入れ子の欄は、その行を押すと開く・閉じる。「任意」の印がある欄は返らないことがある。

  • callIdstring(uuid)
  • status"draft" | "published" | "closed"
  • policy"all_operations" | "no_new_version"
  • appliedboolean
  • allowedboolean
  • createsVersionboolean
  • reapprovalboolean
  • pendingReviewboolean
  • stepsarray<object>件数 ≤20
    • openum(8)"place" "add_inline" "edit_inline" "fork" "refresh" "remove" "shelve" "split"
    • versioninteger
    • createsVersionboolean
    • reapprovalboolean
    • pendingReviewboolean
  • refusalobject | null
    • codestring長さ ≤80
    • statusinteger
    • operationinteger≥0
    • messagestring長さ ≤2000
  • questionsobject
    • addedarray<string>件数 ≤200
    • removedarray<string>件数 ≤200
    • changedarray<string>件数 ≤200
  • beforeobject
    • versioninteger | null
    • hashstring/^[0-9a-f]{64}$/
  • draftAnswersobject
    • draftsinteger≥0
    • affectedarray<object>件数 ≤200
      • questionIdstring長さ ≤80
      • draftsinteger≥1
      • reason"removed" | "type_changed" | "option_removed"
  • questionnaireobject | null
    • callIdstring(uuid)
    • titlestring
    • status"draft" | "published" | "closed"
    • approval"not_required" | "pending" | "approved" | "rejected"
    • policy"all_operations" | "no_new_version"
    • versioninteger | null
    • hashstring/^[0-9a-f]{64}$/
    • pageobject
      • idstring
      • destinationstring
      • placementstring
      • titlestring
      • modulesarray<object | object>
        • |1object
          • kind"shared"
          • idstring
          • moduleIdstring
          • pinned任意object
            • revisioninteger
            • bodyobject
              • titlestring
              • helpstring | null
              • questionsarray<object>
        • |2object
          • kind"inline" | "legacy"
          • idstring
          • bodyobject
            • titlestring
            • helpstring | null
            • questionsarray<object>
    • placedarray<object>
      • refIdstring
      • moduleIdstring
      • revisioninteger | null
      • shelfRevisioninteger | null
      • outdatedboolean
      • archivedboolean
    • applicationCountinteger≥0
    • shelveTargetsobject
      • eventboolean
      • platformboolean

失敗したとき(エラー)

失敗したときの状態コードと、その意味。本文の error の値で、プログラムが失敗の種類を見分けられる。

  • 400HTTP 400(x-bounty-error-codes を参照)
  • 401未ログイン(unauthorized)/ Bearer が無効(invalid_token。WWW-Authenticate 付き)
  • 403HTTP 403(x-bounty-error-codes を参照)
  • 404HTTP 404(x-bounty-error-codes を参照)
  • 409HTTP 409(x-bounty-error-codes を参照)
  • 413HTTP 413(x-bounty-error-codes を参照)
  • 422HTTP 422(x-bounty-error-codes を参照)
  • 428HTTP 428(x-bounty-error-codes を参照)
  • 429レート制限(Retry-After 付き)
  • 503HTTP 503(x-bounty-error-codes を参照)
  • invalid_token
  • forbidden
  • consent_required
  • rate_limited
  • invalid_input
  • call_not_found
  • revision_conflict
  • published_call_new_version
  • questionnaire_invalid
  • module_not_found
  • module_ref_not_found
  • module_already_placed
  • too_many_modules
  • module_not_shared
  • module_is_shared
  • module_already_shared
  • module_key_taken
  • module_invalid
  • shelf_unavailable
  • member_selection_requires_organization

呼び出しの見本

そのまま試せる呼び出しの例。curl と fetch をタブで切り替える。ID やトークンは自分の値に置き換える。

curl -X POST "https://bounty.spikes.4s.link/api/v1/boshu/calls/{id}/questionnaire/apply" \
  -H "Authorization: Bearer $BEARER_AUTH" \
  -H "Content-Type: application/json" \
  -d '{
    "expectedHash": "string",
    "operations": [
      {
        "op": "place",
        "moduleId": "00000000-0000-4000-8000-000000000000"
      }
    ]
  }'
POST /api/v1/boshu/calls/{id}/questionnaire/apply | Bounty Developer