遅延
指定した範囲のランダムな時間だけ待ってから返す。タイムアウト処理やローディング表示の動作確認に使う。
| エンドポイント | https://apis-cloud.net/tools/latency/random |
| 認証 | 不要(CORS 全オリジン許可) |
| 再現性 | ?seed= を付けると同じ結果になる |
クエリパラメータ
sstring任意 |
最小待ち時間を秒で指定するショートカット(0〜30)。?min= より優先される |
minstring任意 |
最小待ち時間ミリ秒(0〜30000、既定 0) |
maxstring任意 |
最大待ち時間ミリ秒(0〜30000、既定は min+1000) |
seedstring任意 |
同じ値なら同じ待ち時間になる |
seedstring任意 |
同じ値を渡すと毎回同じ結果になる |
prettyboolean任意 |
1 で整形して返す |
例
GET/tools/latency/random |
||
GET/tools/latency/random?min=200&max=800 |
||
GET/tools/latency/random?s=3 |
||
よくある質問
- 遅延はどう呼び出しますか?
- GET https://apis-cloud.net/tools/latency/random を呼ぶだけです。認証は不要で、結果はJSONで返ります。
- 同じ結果をもう一度得られますか?
- ?seed= に同じ文字列を渡せば、毎回同じ値が返ります。テストの期待値を固定したいときに使えます。
他のジェネレータ
リクエスト
curl -s "https://apis-cloud.net/tools/latency/random?min=200&max=800"const res = await fetch("https://apis-cloud.net/tools/latency/random?min=200&max=800");
const data = await res.json();import urllib.request, json
with urllib.request.urlopen("https://apis-cloud.net/tools/latency/random?min=200&max=800") as r:
data = json.load(r)