POST/api/messages/{id}
「メッセージ」の分類の、新しく作る、または操作を実行するために内容を送る API。ログインした本人として呼ぶ。
- 要約
送信(text / stamp / location。replyToId で返信。本文の @表示名 はメンション = ミュートを越えて通知。location は { kind, location: { mapId, x, y, label } } で現在の会場図の場所だけ。本文は地点名、通知は「場所が送られました」だけ)
- 呼び方と印
ログイン・レート制限
短い時間に呼びすぎると断られる API(レート制限)。断られたら Retry-After の秒数を待って呼び直す。
URL に付ける値(パラメータ)
経路の中の波かっこの部分と、URL の ? の後ろに付ける値。「必須」の印があるものは省けない。
idpath必須string(uuid)
送るもの(本文)application/json
送る本文の欄。「必須」の印がある欄は省けない。
|1必須objectkind必須"text" | "stamp"body必須string長さ 1–2000replyToId任意string(uuid) | null|2必須objectkind必須"location"location必須objectmapId必須string(uuid)x必須number0–1y必須number0–1label必須string長さ 1–60replyToId任意string(uuid) | null
返るもの(応答)200 · application/json
成功したときに返る形。入れ子の欄は、その行を押すと開く・閉じる。「任意」の印がある欄は返らないことがある。
messageobjectidstringkindenum(6)"text" "stamp" "system" "image" "unsent" "location"bodystringuserIdstring | nullcreatedAtstringupdatedAt任意stringreplyTo任意object | nullidstringuserIdstring | nullsenderNamestring | nullkindenum(6)"text" "stamp" "system" "image" "unsent" "location"snippetstring
reactions任意array<object>emojistringcountintegermineboolean
attachment任意object | nullidstringurlstringmimestringbytesintegerwidthintegerheightinteger
location任意object | nullmapIdstringxnumberynumberlabelstring
hasLinks任意booleanmentions任意array<string>systemKey任意string | nullsystemParams任意record<string> | nullhidden任意booleanunsendableUntil任意string | null
失敗したとき(エラー)
失敗したときの状態コードと、その意味。本文の error の値で、プログラムが失敗の種類を見分けられる。
- 400入力の誤り(error = invalid_input など)
- 401未ログイン(unauthorized)/ Bearer が無効(invalid_token。WWW-Authenticate 付き)
- 403権限が無い
- 429レート制限(Retry-After 付き)
- not_member
- blocked
- read_only
- reply_target_not_found
- reply_target_unavailable
- empty_message
- message_too_long
- invalid_stamp
- invalid_map_pin
- unknown_map
- stale_map
- rate_limited
呼び出しの見本
そのまま試せる呼び出しの例。curl と fetch をタブで切り替える。ID やトークンは自分の値に置き換える。
curl -X POST "https://bounty.spikes.4s.link/api/messages/{id}" \
-H "Authorization: Bearer $BEARER_AUTH" \
-H "Content-Type: application/json" \
-d '{
"kind": "text",
"body": "string"
}'