跳轉到主要內容
POST
/
v1
/
projects
/
{projectId}
/
pathway
/
edges
建立邊
curl --request POST \
  --url https://api.pathors.com/v1/projects/{projectId}/pathway/edges \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "<string>",
  "source": "<string>",
  "target": "<string>",
  "condition": "<string>"
}
'

請求

POST https://api.pathors.com/v1/projects/{projectId}/pathway/edges

路徑參數

projectId
string
必填
專案 ID

標頭

Authorization
string
必填
使用您的 Developer Key 進行 Bearer 令牌認證

請求主體

id
string
選填的邊 ID。若未提供則自動產生。
source
string
必填
來源節點 ID
target
string
必填
目標節點 ID
condition
string
必填
轉換條件(對話何時應從來源移動至目標)

回應

回傳建立的邊,狀態碼為 201 若來源或目標節點不存在,則回傳 400

範例

curl -X POST https://api.pathors.com/v1/projects/{projectId}/pathway/edges \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "node-1",
    "target": "node-2",
    "condition": "User confirms the booking"
  }'
{
  "data": {
    "id": "edge-node-1-node-2-1709827200000",
    "source": "node-1",
    "target": "node-2",
    "data": { "condition": "User confirms the booking" }
  }
}