Batch shorten · 批量短链(短.在线)
shorten_urls一次同步创建 1 到 100 条短链。按 client_ref 对应结果,允许部分成功。需要已注册账户。批量重试只有三种情况,不要混用。示例:key 为 batch-1,两项 client_ref 分别为 notes(https://example.com/notes)和 draft(https://example.com/draft)。notes 成功,draft 的 retryable 为 true。(1) 传输结果不确定(没有拿到已完成的响应、IDEMPOTENCY_IN_PROGRESS、幂等锁不可用,或因瞬时数据库错误且一条都未创建而返回 503):用同一个 key 原样重发整批。已完成的批次返回已保存的结果,notes 不会再次创建。key 已被释放时,同一批会重新执行。(2) 已完成且某项 retryable 为 true:重放 batch-1 只返回已保存的结果,不会重试 draft。只用新 key(例如 batch-1-draft)发送 draft,并保留 client_ref draft,不要带上 notes。去掉 notes 后仍用 batch-1 会返回 IDEMPOTENCY_CONFLICT。(3) 校验错误:改正请求,不要把同一份无效请求当作网络重试。key 尚未保存的 400(重复 client_ref、缺少 items、BATCH_TOO_LARGE)改正后可以继续用同一个 key。已完成且 retryable 为 false 的项已保存;改正文后用原 key 会返回 IDEMPOTENCY_CONFLICT,改正后的项必须用新 key。 Create 1 to 100 short links in one synchronous request. Match each result by client_ref. Partial success is allowed. A registered account is required. Batch retry has three cases; do not mix them. Worked example: key batch-1 with client_ref notes (https://example.com/notes) and draft (https://example.com/draft). notes succeeds and draft is retryable true. (1) Uncertain transport outcome — no completed body, IDEMPOTENCY_IN_PROGRESS, an unavailable idempotency lock, or 503 because a transient database error created nothing: resend the entire unchanged batch with the same key. A completed batch returns the stored result and notes is not created again. A released key runs that same batch again. (2) Completed batch with retryable true: replaying batch-1 returns the stored body and does not retry draft. Send only draft, keeping client_ref draft, under a new key such as batch-1-draft. Do not include notes. Dropping notes and reusing batch-1 returns IDEMPOTENCY_CONFLICT. (3) Validation error: fix the request. Do not resend the same invalid body as a network retry. A 400 before the key is stored (duplicate client_ref, missing items, BATCH_TOO_LARGE) may reuse the key after the body is corrected. A completed item with retryable false is stored; a changed body on that key returns IDEMPOTENCY_CONFLICT, so send the corrected item with a new key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Synchronous batch items (1 to 100). Each item creates one short link. | |
| idempotency_key | Yes | Client-generated unique key for this create. Required. Replays within 24h. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||