開発者ドキュメント

ShortcutsとX-callback-url

組み込みアクションとコールバックエンドポイントを使用して、スループットチェック、エンドポイント検証、結果収集を自動化。

概要

iPerf3クライアント&サーバーは2つのオートメーションレイヤーを公開しています:

  • ネイティブApple Shortcutsアクション(ほとんどのユーザーに推奨)
  • スクリプタブルなアプリ間ワークフロー用のx-callback-urlエンドポイント
ベースURLスキーム

コールバックベースのオートメーションにはiperf3cs://x-callback-url/...を使用。

互換性

現在のAppleプラットフォーム要件はiOS/iPadOS 16.6以降、macOS 13.5以降、visionOS 1.0以降です。

組み込みShortcutsアクション

これらのアクションはApple Shortcutsアプリで直接利用可能です:

iPerf テストを実行

設定可能なサーバー、プロトコル、方向、タイミングでテストを実行。Shortcutsフローのデフォルト時間は通常5秒です。

最新結果を取得

ローカル履歴から最新の完了結果を返します。

サーバーをテスト

完全な実行前にエンドポイントの可用性を確認します。

サーバーをリスト

メニュー駆動のオートメーション用に設定済みサーバーを返します。

x-callback-urlエンドポイント

GETiperf3cs://x-callback-url/run-test

Runs a test and returns the result through the callback URLs.

パラメーター タイプ 必須 説明
serverId String いいえ Saved server to use: host:port, a server UUID, or default. Omit it and the default server is used.
serverName String いいえ Pick the server by its saved name instead of serverId. Takes precedence when both are present.
autoAdd Boolean いいえ Create the server if it is not in the library yet. addServer is accepted as an alias.
durationSec Integer いいえ Test length in seconds. Defaults to 5.
protocol String いいえ tcp (default) or udp.
direction String いいえ download, upload or bidirectional.
streams Integer いいえ Parallel stream count.
bandwidthMbps Number いいえ Target bandwidth for UDP tests, in Mbps.
format String いいえ json (default) or text.
x-success String いいえ Callback URL. Receives result with the payload, or resultRef when the payload is too large to pass in a URL.
x-error String いいえ Callback URL. Receives errorCode and errorMessage.
x-cancel String いいえ Callback URL for a cancelled run.

GETiperf3cs://x-callback-url/get-last-result

Returns the most recent saved result. Useful for periodic logging.

パラメーター タイプ 必須 説明
serverId String いいえ Limit the lookup to one server: host:port, a UUID, or default. Omit it for the latest result overall.
serverName String いいえ Same lookup by saved name. Takes precedence over serverId.
format String いいえ json (default) or text.
x-success String いいえ Callback URL. Receives result with the payload, or resultRef when the payload is too large to pass in a URL.
x-error String いいえ Callback URL. Receives errorCode and errorMessage.
x-cancel String いいえ Callback URL for a cancelled run.

GETiperf3cs://x-callback-url/fetch-result

Fetches a payload the app handed back as a reference. When a result is too large for a callback URL, the app returns <code>resultRef</code> instead of <code>result</code>, and this endpoint exchanges that reference for the full payload.

パラメーター タイプ 必須 説明
resultRef String はい Reference returned earlier in place of result.
format String いいえ json (default) or text.
x-success String いいえ Callback URL. Receives result with the payload, or resultRef when the payload is too large to pass in a URL.
x-error String いいえ Callback URL. Receives errorCode and errorMessage.
x-cancel String いいえ Callback URL for a cancelled run.

コールバック付きテストの実行

iperf3cs://x-callback-url/run-test?serverId=iperf.example.com:5201&autoAdd=1&protocol=tcp&direction=download&durationSec=8&format=json&x-success=shortcuts://run-shortcut?name=StoreResult

最新結果の読み取り

iperf3cs://x-callback-url/get-last-result?format=json&x-success=shortcuts://run-shortcut?name=PushSummary

macOSでのターミナル起動

open "iperf3cs://x-callback-url/run-test?serverId=10.0.1.5:5201&protocol=udp&direction=bidirectional&durationSec=5"

典型的なペイロードフィールド

{ "success": true, "startTime": "2026-08-21T09:42:02Z", "endTime": "2026-08-21T09:42:10Z", "duration": 8, "receivedMegabitsPerSecond": 942.7, "sentMegabitsPerSecond": 876.4, "receivedBytes": 942700000, "summaryText": "942.7 Mbps down, 876.4 Mbps up" }

エラー処理

アクションが失敗しx-errorが存在する場合、コールバックはエラーオブジェクトを受け取ります。

コード 説明
invalidParameter A parameter is missing, malformed or out of range.
serverNotFound No saved server matched the lookup, and autoAdd was not set.
networkUnavailable The device has no usable network path to the endpoint.
connectionTimeout The connection or the test exceeded its timeout.
testFailed The test started and ended without a usable result.
cancelled The run was cancelled before it finished.
requiresAppOpen The action needs the app in the foreground.
unsupportedOnOSVersion The action is not available on this OS version.
{ "errorCode": "serverNotFound", "errorMessage": "No saved server matches iperf.example.com:5201" }

よくある質問

コールバックがShortcutsに戻らないのはなぜですか?

コールバックURLがURLエンコードされており、スキームがデバイスで許可されていることを確認してください。クエリ値にスペースやエスケープされていない記号を使用しないでください。

テストをバックグラウンドで完全に実行できますか?

確実な実行のため、テスト実行中はアプリをアクティブな状態に保ってください。Shortcutsのスケジュール機能を使用して特定の時間にテストを起動してください。

最も安全な統合パターンは何ですか?

すべての呼び出しにx-errorを指定し、errorCodeで分岐してください。まずdurationSec=5の短い実行から始め、serverNotFoundconnectionTimeoutが返る場合は長いテストを走らせる意味がありません。