UiPath Documentation
uipath-cli
latest
false
重要 :
このコンテンツは機械翻訳によって処理されています。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

UiPath CLI ユーザー ガイド

操作方法: Orchestrator のリソースを管理する

uip resource ツールは、Orchestrator のランタイム リソース (アセット、バケット (およびその中のファイル)、ライブラリ、キュー (およびアイテム)、トリガー、Webhook など) を対象とする汎用の CRUD です。このページでは、アセットの一括作成、バケットへのファイルの移動、キュー作業のディスパッチ、トリガーの検査など、毎日発生するタスクをコピー&ペースト可能なスニペットとしてまとめています。

すべてのサブコマンドの完全なフラグリストは、 uip resource リファレンスページにあります。このページでは、一般的な使用パターンについて説明します。

注:

uip resourceuip solution resourceとは異なります。前者は Orchestrator の CRUD サーフェスです (このページ)。後者は、.uipxソリューション内のローカルリソース宣言を検査します。疑わしい場合は、接頭辞を見てください: uip solution resource … ディスクしか読みません。 uip resource … 常に Orchestrator を呼び出します。

最初に知っておく必要のある規則

スニペットが機能する前に:

  • 認証。すべての uip resource 動詞が Orchestrator を呼び出します。最初に uip login を実行します。任意の動詞に --tenant <name> (短い -t) を渡して、1 回の呼び出しのセッション テナントをオーバーライドします。
  • フォルダーの範囲。アセット、バケット、キュー、キュー アイテム、タイム トリガー/キュー トリガーは フォルダー範囲であり--folder-path を渡します (例:Shared) または --folder-key (GUID) を使用できます。ライブラリ、API トリガー、Webhook は テナント範囲であり 、フォルダー フラグは拒否されます。
  • キー。リスト動詞は GUID (keyidentifieruniqueKey) を返します。これらを getupdateおよび deleteに渡します。数値 id フィールドは内部です。それらをコマンドに渡さないでください。
  • JSON が既定の出力です。以下のすべてのスニペットはこれに依存しています。 詳しくは、「出力形式」をご覧ください。

アセット

CSV からアセットを一括デプロイする

これは、最も一般的な「シークレットと構成の管理」タスクです。次のようなCSVがあるとします。

name,value,type,folderPath
ApiEndpoint,https://api.example.com,Text,Shared
MaxRetries,3,Integer,Shared
Debug,false,Bool,Shared
name,value,type,folderPath
ApiEndpoint,https://api.example.com,Text,Shared
MaxRetries,3,Integer,Shared
Debug,false,Bool,Shared

プレーンなbash + uip resource assets createでループします。

#!/usr/bin/env bash
set -euo pipefail

# Skip the header row
tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
  uip resource assets create "$name" "$value" \
    --folder-path "$folder" \
    --type "$type"
done
#!/usr/bin/env bash
set -euo pipefail

# Skip the header row
tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
  uip resource assets create "$name" "$value" \
    --folder-path "$folder" \
    --type "$type"
done

重複すると、同じフォルダーに対してこれを再実行すると失敗します。これを処理するには、次の 2 つの方法があります。

  • パターンを更新/挿入します。最初にリストし、次に行ごとに create または update します。

    tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
      existing=$(uip resource assets list --folder-path "$folder" --name "$name" \
        --output-filter "Data[?name=='$name'] | [0].key" --output plain)
    
      if [ -n "$existing" ] && [ "$existing" != "null" ]; then
        uip resource assets update "$existing" "$value"
      else
        uip resource assets create "$name" "$value" --folder-path "$folder" --type "$type"
      fi
    done
    tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
      existing=$(uip resource assets list --folder-path "$folder" --name "$name" \
        --output-filter "Data[?name=='$name'] | [0].key" --output plain)
    
      if [ -n "$existing" ] && [ "$existing" != "null" ]; then
        uip resource assets update "$existing" "$value"
      else
        uip resource assets create "$name" "$value" --folder-path "$folder" --type "$type"
      fi
    done
    
  • ソリューションのデプロイ パターン。パッケージと一緒に出荷されるアセット セットの場合は、ソリューション マニフェストで宣言し、uip solution deploy run --config-file を使用します — そのパスは設計上べき等です。「 方法: ソリューションをパッケージ化してパブリッシュする」をご覧ください。

Credential タイプのアセット

Credential アセットと Secret アセットには、資格情報ストア キーが必要です。

# Find the credential store
STORE_KEY=$(uip or credential-stores list \
  --output-filter "Data[?name=='MyStore'] | [0].key" --output plain)

# Create the credential asset (value format: username:password)
uip resource assets create ApiLogin "alice:s3cr3t" \
  --folder-path Shared \
  --type Credential \
  --credential-store-key "$STORE_KEY"
# Find the credential store
STORE_KEY=$(uip or credential-stores list \
  --output-filter "Data[?name=='MyStore'] | [0].key" --output plain)

# Create the credential asset (value format: username:password)
uip resource assets create ApiLogin "alice:s3cr3t" \
  --folder-path Shared \
  --type Credential \
  --credential-store-key "$STORE_KEY"

Credential と secret の値は、listgetによって返されることはありませんassets get-asset-value (フォルダー スコープが必要です) を使用してライブ値を読み取るか、ロボットを介して呼び出します。

フォルダー間でアセットを共有する

Sharedに一度作成し、それを必要とする各フォルダーで共有します。

ASSET_KEY=$(uip resource assets list --folder-path Shared --name ApiEndpoint \
  --output-filter "Data[0].key" --output plain)

for folder in Production Staging Development; do
  uip resource assets share "$ASSET_KEY" --folder-path "$folder"
done
ASSET_KEY=$(uip resource assets list --folder-path Shared --name ApiEndpoint \
  --output-filter "Data[0].key" --output plain)

for folder in Production Staging Development; do
  uip resource assets share "$ASSET_KEY" --folder-path "$folder"
done

Revoke with unshare(で取り消します。完全な動詞のリストについては、 アセット を参照してください。

バケットとバケット ファイル

ローカル ファイルをアップロードする

BUCKET_KEY=$(uip resource buckets list --folder-path Shared \
  --output-filter "Data[?name=='invoices'] | [0].key" --output plain)

uip resource bucket-files write "$BUCKET_KEY" "inbox/invoice-001.pdf" \
  --folder-path Shared \
  --file ./invoice-001.pdf
BUCKET_KEY=$(uip resource buckets list --folder-path Shared \
  --output-filter "Data[?name=='invoices'] | [0].key" --output plain)

uip resource bucket-files write "$BUCKET_KEY" "inbox/invoice-001.pdf" \
  --folder-path Shared \
  --file ./invoice-001.pdf

バケット内のパス(inbox/invoice-001.pdf)は、 writeの2番目の引数です。 --file アップロードするローカル パスです。コンテンツの種類は自動検出されます。オーバーライドする --content-type を渡します。

ファイルをダウンロードする

uip resource bucket-files read "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared \
  --destination ./summary.csv
uip resource bucket-files read "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared \
  --destination ./summary.csv

--destinationを使用しない場合、コンテンツは stdout にストリーミングされ、プロセッサにパイプ接続するのに便利です。

リストとページネーション

# First page
uip resource bucket-files list "$BUCKET_KEY" --folder-path Shared

# The response carries a continuationToken — pass it back to fetch the next page
uip resource bucket-files list "$BUCKET_KEY" --folder-path Shared \
  --continuation-token "<token-from-previous-response>"
# First page
uip resource bucket-files list "$BUCKET_KEY" --folder-path Shared

# The response carries a continuationToken — pass it back to fetch the next page
uip resource bucket-files list "$BUCKET_KEY" --folder-path Shared \
  --continuation-token "<token-from-previous-response>"

バケットファイルのリストは、オフセットページネーションではなく継続トークンを使用するCLIの1つのリソースであり、他のリスト動詞は --limit / --offsetを取ります。

署名済み URL

ロボットまたは外部サービスが CLI を経由せずに直接 BLOB にアクセスする必要がある場合は、以下の手順を実行します。

uip resource bucket-files get-upload-url "$BUCKET_KEY" "inbox/incoming.pdf" \
  --folder-path Shared --expiry-in-minutes 30

uip resource bucket-files get-download-url "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared --expiry-in-minutes 30
uip resource bucket-files get-upload-url "$BUCKET_KEY" "inbox/incoming.pdf" \
  --folder-path Shared --expiry-in-minutes 30

uip resource bucket-files get-download-url "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared --expiry-in-minutes 30

どちらも、スコープが 1 つのファイル パスに限定された時間制限付きの URL を返します。

キューおよびキュー アイテム

キューを作成する

uip resource queues create InvoiceQueue \
  --folder-path Shared \
  --max-retries 3 \
  --retention-period 90
uip resource queues create InvoiceQueue \
  --folder-path Shared \
  --max-retries 3 \
  --retention-period 90

完全なフラグリスト( --auto-retry--enforce-unique-reference--encrypted、保持設定)は、 キューの参照にあります。

作業項目を 1 つ追加する

uip resource queue-items add InvoiceQueue \
  --folder-path Shared \
  --specific-content '{"InvoiceId":"INV-001","Amount":1500}' \
  --priority High
uip resource queue-items add InvoiceQueue \
  --folder-path Shared \
  --specific-content '{"InvoiceId":"INV-001","Amount":1500}' \
  --priority High

--specific-content は、ロボットが読み取る JSON ペイロードです。

ファイルから一括追加

cat > ./items.json <<'EOF'
[
  {"Name": "InvoiceQueue", "Priority": "Normal", "SpecificContent": {"InvoiceId":"INV-001"}},
  {"Name": "InvoiceQueue", "Priority": "Normal", "SpecificContent": {"InvoiceId":"INV-002"}}
]
EOF

ITEMS=$(jq -c . ./items.json)
uip resource queue-items bulk-add InvoiceQueue \
  --folder-path Shared \
  --queue-items "$ITEMS" \
  --commit-type StopOnFirstFailure
cat > ./items.json <<'EOF'
[
  {"Name": "InvoiceQueue", "Priority": "Normal", "SpecificContent": {"InvoiceId":"INV-001"}},
  {"Name": "InvoiceQueue", "Priority": "Normal", "SpecificContent": {"InvoiceId":"INV-002"}}
]
EOF

ITEMS=$(jq -c . ./items.json)
uip resource queue-items bulk-add InvoiceQueue \
  --folder-path Shared \
  --queue-items "$ITEMS" \
  --commit-type StopOnFirstFailure

--commit-type 1 つの行が検証に失敗した場合の挙動を制御します。 ProcessAllIndependently (既定)、 StopOnFirstFailure、または AllOrNothingです。

失敗したアイテムを検査する

uip resource queue-items list --folder-path Shared \
  --queue-name InvoiceQueue \
  --status Failed \
  --output-filter "Data[].{key:uniqueKey, ref:reference, reason:processingException}"
uip resource queue-items list --folder-path Shared \
  --queue-name InvoiceQueue \
  --status Failed \
  --output-filter "Data[].{key:uniqueKey, ref:reference, reason:processingException}"

1 つのuniqueKeyqueue-items get-history を使用すると、その完全な状態遷移履歴が表示されるため、再試行ループの診断に役立ちます。

失敗したアイテムをリトライ対象としてマークする

uip resource queue-items set-review-status Retried \
  "<queue-item-key-1>" "<queue-item-key-2>"
uip resource queue-items set-review-status Retried \
  "<queue-item-key-1>" "<queue-item-key-2>"

set-review-statusRetriedAbandonedDeletedのいずれかを取ります。

トリガー

フォルダー内のトリガーのリストを取得

uip resource triggers list --type time --folder-path Shared --enabled \
  --output-filter "Data[].{name:name, cron:startProcessCron, enabled:isEnabled}"
uip resource triggers list --type time --folder-path Shared --enabled \
  --output-filter "Data[].{name:name, cron:startProcessCron, enabled:isEnabled}"

トリガーの 3 種類: timequeueapiすべての動詞に --type を渡します(デフォルトは timeです)。API トリガーはテナント範囲です。 --folder-pathは省略します。

タイム トリガーを作成する

RELEASE_KEY=$(uip or processes list --folder-path Shared --name InvoiceProcessing \
  --output-filter "Data[0].Key" --output plain)

uip resource triggers create --type time \
  --name NightlyInvoices \
  --release-key "$RELEASE_KEY" \
  --runtime-type Unattended \
  --job-priority Normal \
  --folder-path Shared \
  --cron "0 0 2 * * ?" \
  --time-zone UTC
RELEASE_KEY=$(uip or processes list --folder-path Shared --name InvoiceProcessing \
  --output-filter "Data[0].Key" --output plain)

uip resource triggers create --type time \
  --name NightlyInvoices \
  --release-key "$RELEASE_KEY" \
  --runtime-type Unattended \
  --job-priority Normal \
  --folder-path Shared \
  --cron "0 0 2 * * ?" \
  --time-zone UTC

--cron値は、標準の cron ではなく、Quartz の 6 フィールド形式 (sec min hour dayOfMonth month dayOfWeek) を使用します。"0 0 2 * * ?" は「毎日02:00」です。

トリガーを有効化または無効化する

uip resource triggers enable <trigger-key> --type time --folder-path Shared
uip resource triggers disable <trigger-key> --type time --folder-path Shared
uip resource triggers enable <trigger-key> --type time --folder-path Shared
uip resource triggers disable <trigger-key> --type time --folder-path Shared

triggers historyを使用して、起動していないトリガーを診断します—火災ログには、不足しているライセンス、使用できないマシン、およびその他のアップストリームブロックが表示されます。

Webhook

Webhook はテナントスコープです。1 回作成すると、テナント内で一致するイベントごとに Webhook が発生します。

uip resource webhooks create --name JobAlerts \
  --url https://hooks.example.com/uipath \
  --events "job.completed,job.faulted" \
  --secret "$WEBHOOK_SECRET"
uip resource webhooks create --name JobAlerts \
  --url https://hooks.example.com/uipath \
  --events "job.completed,job.faulted" \
  --secret "$WEBHOOK_SECRET"

テナントで利用可能なイベントの種類を一覧表示します。

uip resource webhooks event-types
uip resource webhooks event-types

実際のイベントを待たずに配信をテストします。

uip resource webhooks ping <webhook-key>
uip resource webhooks ping <webhook-key>

ライブラリ

ライブラリはテナント範囲 (フォルダー範囲ではない) です。テナント フィードに存在し、次のようなパッケージ ID で参照されますMyLib:1.0.0

# Upload a new version
uip resource libraries upload --file ./MyLib.1.0.0.nupkg

# See all versions of a package
uip resource libraries versions MyLib

# Download a specific version
uip resource libraries download MyLib:1.0.0 --destination ./MyLib.1.0.0.nupkg
# Upload a new version
uip resource libraries upload --file ./MyLib.1.0.0.nupkg

# See all versions of a package
uip resource libraries versions MyLib

# Download a specific version
uip resource libraries download MyLib:1.0.0 --destination ./MyLib.1.0.0.nupkg

キーの形式は PackageId:Version であり、GUID ではありません。

スクリプティングのヒント

  • 変数に 1 つの値を渡すときは、必ず --output-filter を渡します。脆弱な jq 呼び出しを回避し、CLI解析時に検証します( スクリプトパターンを参照)。
  • List 動詞は、ページ分割された結果 (ほとんどの場合 --limit / --offset 、バケット ファイル --continuation-token ) を返します。空の結果( Dataの行がゼロ)は 0 を終了します—リストクエリは成功しました。一致するものは何もありませんでした。
  • ほとんどの更新/削除動詞はクロスフォルダです —uip resourceの各動詞のセクションのフラグテーブルには明示的にそう書かれています(「クロスフォルダ」)。これらのリソースに対するフォルダー スコープが必要なのは、 create と list のみです。

参照

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得