ワークフローの連携
ワークフローの連携
GPTBotsのワークフローは連携のためのAPIとして機能します。
リクエストメソッド
POST
リクエストURL
https://api-{endpoint}.gptbots.ai/v1/workflow/invoke
リクエスト認証
認証方法の説明についてはAPI Overviewをご参照ください。
リクエスト
curl -X POST 'https://api-{endpoint}.gptbots.ai/v1/workflow/invoke' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"userId": "<your_user_id>",
"input": {
<your_start>
}
}'
curl -X POST 'https://api-{endpoint}.gptbots.ai/v1/workflow/invoke' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"userId": "<your_user_id>",
"input": {
<your_start>
}
}'
このコードブロックをポップアップで表示
リクエストパラメータ
フィールド | タイプ | 説明 |
---|---|---|
Authorization | Bearer ${API Key} | 認証には Authorization: Bearer ${API Key} を使用してください。トークンはAPIキーページから取得できます。 |
Content-Type | application/json | データの形式は application/json を設定してください。 |
リクエストボディ
フィールド | タイプ | 必須 | 解説 |
---|---|---|---|
userId | String | 任意 | このリクエストを開始した人の識別子として機能します。 |
input | Object | 必須 | ワークフローの Start ノードを表します。このフィールド内のパラメータは、ワークフローの Start ノードで指定されたパラメータと一致している必要があります。 |
レスポンス
レスポンス例
{
"workflowId": "xxxxxxxx",
"workflowName": "todayNews",
"workflowVersion": "9",
"workflowRunId": "xxxxxxxx",
"input": {
"topic": "hi"
},
"output": {
"news": [
{
"summary": "Fatal crash shuts down major highway in Haleiwa. According to Emergency Medical Services, paramedics responded to the scene of the crash Wednesday morning.",
"media": "Hawaii News Now",
"title": "Hawaii News Now - Breaking News, Latest News, Weather & Traffic"
},
{
"summary": "Hawaii Crime: Man, 65, critically injured in Waikīkī assault. Jamil Hart found guilty in Mililani murder case. HPD busts illegal gambling room in Nanakuli.",
"media": "KHON2",
"title": "KHON2: Hawaii News, Weather, Sports, Breaking News & Live"
},
{
"summary": "Man left with serious injuries after being hit by car in Hawaii Kai. Holomua brush fire 50% contained; 380 acres burned. Haleiwa collision claims one life.",
"media": "KITV 4",
"title": "KITV 4 Island News | Honolulu, HI News & Weather"
},
{
"summary": "Hawaii news daily. In-depth reporting on breaking news and more for Honolulu, Big Island, Maui and Kauai counties. No paywall.",
"media": "Honolulu Civil Beat",
"title": "Hawaii News: In-Depth Local News From Honolulu Civil Beat"
},
{
"summary": "Breaking News: Man, 21, dies in crash on J.P. Leong Highway in Haleiwa. Gunman inscribed 'ANTI-ICE' on bullet before fatal Dallas attack. Man, 44, dies after...",
"media": "Honolulu Star-Advertiser",
"title": "Honolulu Star-Advertiser: Hawaii News, Breaking News & Top Stories"
}
]
},
"workflowExecutionTime": 8347,
"status": "SUCCEED",
"totalCost": 0.6928,
"totalTokens": 1745,
"startTime": 1758765323024,
"endTime": 1758765331373
}
{
"workflowId": "xxxxxxxx",
"workflowName": "todayNews",
"workflowVersion": "9",
"workflowRunId": "xxxxxxxx",
"input": {
"topic": "hi"
},
"output": {
"news": [
{
"summary": "Fatal crash shuts down major highway in Haleiwa. According to Emergency Medical Services, paramedics responded to the scene of the crash Wednesday morning.",
"media": "Hawaii News Now",
"title": "Hawaii News Now - Breaking News, Latest News, Weather & Traffic"
},
{
"summary": "Hawaii Crime: Man, 65, critically injured in Waikīkī assault. Jamil Hart found guilty in Mililani murder case. HPD busts illegal gambling room in Nanakuli.",
"media": "KHON2",
"title": "KHON2: Hawaii News, Weather, Sports, Breaking News & Live"
},
{
"summary": "Man left with serious injuries after being hit by car in Hawaii Kai. Holomua brush fire 50% contained; 380 acres burned. Haleiwa collision claims one life.",
"media": "KITV 4",
"title": "KITV 4 Island News | Honolulu, HI News & Weather"
},
{
"summary": "Hawaii news daily. In-depth reporting on breaking news and more for Honolulu, Big Island, Maui and Kauai counties. No paywall.",
"media": "Honolulu Civil Beat",
"title": "Hawaii News: In-Depth Local News From Honolulu Civil Beat"
},
{
"summary": "Breaking News: Man, 21, dies in crash on J.P. Leong Highway in Haleiwa. Gunman inscribed 'ANTI-ICE' on bullet before fatal Dallas attack. Man, 44, dies after...",
"media": "Honolulu Star-Advertiser",
"title": "Honolulu Star-Advertiser: Hawaii News, Breaking News & Top Stories"
}
]
},
"workflowExecutionTime": 8347,
"status": "SUCCEED",
"totalCost": 0.6928,
"totalTokens": 1745,
"startTime": 1758765323024,
"endTime": 1758765331373
}
このコードブロックをポップアップで表示
レスポンスボディ
フィールド | タイプ | 説明 |
---|---|---|
workflowId | string | ワークフローのID。 |
workflowName | string | ワークフローの名前。 |
workflowVersion | string | ワークフローのバージョン。 |
workflowRunId | String | ワークフローの実行ID(この実行の一意な識別子)です。 |
input | Object | Startノードの入力内容です。リクエストの"input field"の内容と一致する必要があります。 |
output | Object | Endノードの出力内容です。ワークフローの実行結果もここに含まれます。 |
workflowExecutionTime | Number | ワークフローの実行時間(単位: ms)。 |
status | String | ワークフローの結果を表します。以下の値のいずれかになります:SUCCEED :成功FAILED :失敗RUNNING :実行中 |
totalCost | Number | トータルのクレジット使用量(すべてのノードの使用量を合計);単位:クレジット。 |
totalTokens | Number | トータルのトークン使用量(すべてのノードの使用量を合計) |
startTime | Number | アクション開始のタイムスタンプ(単位:ms) |
endTime | Number | アクション終了のタイムスタンプ(単位:ms) |