callリファレンス
[更新: 2025年7月17日]
ワークフローのステップの一つであるcallで使える関数について記載します。
feed
parse
XML形式のデータ(Atomフィード)を解析して、フィードのタイトルとその中に含まれるエントリー(項目)をJSON形式のデータに変換します。
引数 |
説明 |
---|---|
xml |
解析するXML形式のデータ |
例
steps:
get:
call: http.get
args:
url: ${"https://sample-feeds.rowanmanning.com/examples/64968fb0e3685ef07a3e2a27b8d64c01/feed.xml"}
timeout: 10
headers:
"Accept": "application/rss+xml"
result: feedData
parse:
call: feed.parse
args:
xml: ${feedData.body}
result: parsedFeed
done:
return: ${parsedFeed.title + " > " + parsedFeed.entries[0].title + " @ " + parsedFeed.entries[0].updated}
# return "Example Feed > Atom-Powered Robots Run Amok @ 2003-12-13T18:30:02.000Z"
http
get
指定されたURLにHTTP GETリクエストを送信します。
引数 |
説明 |
---|---|
|
|
|
|
|
|
|
|
戻り値
Map<string, any>
HTTPリクエストの結果。
status: HTTPステータスコード。
body: レスポンスボディ。
例
steps:
get:
call: http.get
args:
url: ${"https://httpbin.org/get"}
timeout: 10
headers:
"Content-Type": application/json
query:
"hl": "ja"
"q": "q"
result: response
done:
return: ${response}
post
指定されたURLにHTTP POSTリクエストを送信します。
引数 |
説明 |
---|---|
|
|
|
|
|
|
|
|
|
|
戻り値
Map<string, any>
HTTPリクエストの結果。
status: HTTPステータスコード。
body: レスポンスボディ。
例
steps:
post:
call: http.post
args:
url: ${"https://httpbin.org/post"}
timeout: 10
headers:
"Content-Type": application/json
body:
"key": "value"
result: response
done:
return: ${response}
put
指定されたURLにHTTP PUTリクエストを送信します。
引数 |
説明 |
---|---|
|
|
|
|
|
|
|
|
|
|
戻り値
Map<string, any>
HTTPリクエストの結果。
status: HTTPステータスコード。
body: レスポンスボディ。
例
steps:
put:
call: http.put
args:
url: ${"https://httpbin.org/put"}
timeout: 10
headers:
"Content-Type": application/json
body:
"key": "value"
result: response
done:
return: ${response}
delete
指定されたURLにHTTP DELETEリクエストを送信します。
引数 |
説明 |
---|---|
|
|
|
|
|
|
|
|
|
|
戻り値
Map<string, any>
HTTPリクエストの結果。
status: HTTPステータスコード。
body: レスポンスボディ。
例
steps:
delete:
call: http.delete
args:
url: ${"https://httpbin.org/delete"}
timeout: 10
headers:
"Content-Type": application/json
body:
"key": "value"
result: response
done:
return: ${response}
patch
指定されたURLにHTTP PATCHリクエストを送信します。
引数 |
説明 |
---|---|
|
|
|
|
|
|
|
|
|
|
戻り値
Map<string, any>
HTTPリクエストの結果。
status: HTTPステータスコード。
body: レスポンスボディ。
例
steps:
patch:
call: http.patch
args:
url: ${"https://httpbin.org/patch"}
timeout: 10
headers:
"Content-Type": application/json
body:
"key": "value"
result: response
done:
return: ${response}
request
HTTPリクエストを送信します。 これは汎用関数ですが、ほとんどの場合、 http.get
や http.post
などの特定の関数を使う方が簡単です。 詳細については、HTTPリクエストの作成 を参照してください。
引数 |
説明 |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
戻り値
Map<string, any>
HTTPリクエストの結果。
status: HTTPステータスコード。
body: レスポンスボディ。
例
steps:
request:
call: http.request
args:
method: GET
url: ${"https://httpbin.org/get"}
timeout: 10
headers:
"Content-Type": application/json
query:
"hl": "ja"
"q": "q"
result: response
done:
return: ${response}
sakuraCloud
request
さくらクラウドのAPIを呼び出します。 詳細については各APIのドキュメントを参照してください。
実行にはワークフローにサービスプリンシパルが正常に関連付けられている必要があります。
ワークフローに紐づけられているサービスプリンシパルは呼び出すサービスの各権限が付与されている必要があります。
引数 |
説明 |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
戻り値
Map<string, any>
APIリクエストの結果。
status: HTTPステータスコード。
body: レスポンスボディ。
例
steps:
getWorkflows:
call: sakuraCloud.request
args:
endpoint: https://secure.sakura.ad.jp/cloud/zone/is1z/api/workflow/1.0/workflows/
method: GET
headers:
Accept: "application/json"
timeout: 300
result: response
done:
return: ${json.decode(response.body)}
sys
sleep
指定した秒数分実行を一時停止します。
引数 |
説明 |
---|---|
|
|
例
meta:
description: 秒数ループ
steps:
seconds:
for:
in: '${array.range(10)}'
as: i
steps:
push:
assign:
message: "loop ${i}"
sleep:
call: sys.sleep
args:
seconds: 1
sleepUntil
指定された時間まで待機します。
引数 |
説明 |
---|---|
|
|
例
meta:
description: 時間指定待機
steps:
set:
assign:
setDate: ${"2025-01-01T00:00:00+09:00"} # 任意の未来の時間に変更
sleepUntil:
call: sys.sleepUntil
args:
date: ${setDate}
done:
return: "done"