建立邊
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>"
}
'import requests
url = "https://api.pathors.com/v1/projects/{projectId}/pathway/edges"
payload = {
"id": "<string>",
"source": "<string>",
"target": "<string>",
"condition": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({id: '<string>', source: '<string>', target: '<string>', condition: '<string>'})
};
fetch('https://api.pathors.com/v1/projects/{projectId}/pathway/edges', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/v1/projects/{projectId}/pathway/edges",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '<string>',
'source' => '<string>',
'target' => '<string>',
'condition' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/v1/projects/{projectId}/pathway/edges"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"condition\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pathors.com/v1/projects/{projectId}/pathway/edges")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"condition\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/v1/projects/{projectId}/pathway/edges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"condition\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body建立邊
新增一條連接兩個節點的邊
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>"
}
'import requests
url = "https://api.pathors.com/v1/projects/{projectId}/pathway/edges"
payload = {
"id": "<string>",
"source": "<string>",
"target": "<string>",
"condition": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({id: '<string>', source: '<string>', target: '<string>', condition: '<string>'})
};
fetch('https://api.pathors.com/v1/projects/{projectId}/pathway/edges', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/v1/projects/{projectId}/pathway/edges",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '<string>',
'source' => '<string>',
'target' => '<string>',
'condition' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/v1/projects/{projectId}/pathway/edges"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"condition\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pathors.com/v1/projects/{projectId}/pathway/edges")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"condition\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/v1/projects/{projectId}/pathway/edges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"condition\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body請求
POST https://api.pathors.com/v1/projects/{projectId}/pathway/edges
路徑參數
專案 ID
標頭
使用您的 Developer Key 進行 Bearer 令牌認證
請求主體
選填的邊 ID。若未提供則自動產生。
來源節點 ID
目標節點 ID
轉換條件(對話何時應從來源移動至目標)
回應
回傳建立的邊,狀態碼為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" }
}
}
⌘I
