Skip to main content
POST
/
v1
/
projects
/
{projectId}
/
pathway
/
nodes
建立節點
curl --request POST \
  --url https://api.pathors.com/v1/projects/{projectId}/pathway/nodes \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "<string>",
  "position": {},
  "data": {
    "data.type": "<string>",
    "data.title": "<string>",
    "data.prompt": "<string>",
    "data.tools": [
      "<string>"
    ],
    "data.referenceNodeId": "<string>"
  }
}
'
import requests

url = "https://api.pathors.com/v1/projects/{projectId}/pathway/nodes"

payload = {
"id": "<string>",
"position": {},
"data": {
"data.type": "<string>",
"data.title": "<string>",
"data.prompt": "<string>",
"data.tools": ["<string>"],
"data.referenceNodeId": "<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>',
position: {},
data: {
'data.type': '<string>',
'data.title': '<string>',
'data.prompt': '<string>',
'data.tools': ['<string>'],
'data.referenceNodeId': '<string>'
}
})
};

fetch('https://api.pathors.com/v1/projects/{projectId}/pathway/nodes', 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/nodes",
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>',
'position' => [

],
'data' => [
'data.type' => '<string>',
'data.title' => '<string>',
'data.prompt' => '<string>',
'data.tools' => [
'<string>'
],
'data.referenceNodeId' => '<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/nodes"

payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"position\": {},\n \"data\": {\n \"data.type\": \"<string>\",\n \"data.title\": \"<string>\",\n \"data.prompt\": \"<string>\",\n \"data.tools\": [\n \"<string>\"\n ],\n \"data.referenceNodeId\": \"<string>\"\n }\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/nodes")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"position\": {},\n \"data\": {\n \"data.type\": \"<string>\",\n \"data.title\": \"<string>\",\n \"data.prompt\": \"<string>\",\n \"data.tools\": [\n \"<string>\"\n ],\n \"data.referenceNodeId\": \"<string>\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pathors.com/v1/projects/{projectId}/pathway/nodes")

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 \"position\": {},\n \"data\": {\n \"data.type\": \"<string>\",\n \"data.title\": \"<string>\",\n \"data.prompt\": \"<string>\",\n \"data.tools\": [\n \"<string>\"\n ],\n \"data.referenceNodeId\": \"<string>\"\n }\n}"

response = http.request(request)
puts response.read_body

請求

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

路徑參數

projectId
string
required
專案 ID

標頭

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

請求主體

id
string
required
唯一的節點 ID
position
object
required
節點在畫布上的位置:{ "x": number, "y": number }
data
object
required
節點組態。必須包含 type 及該類型專屬的欄位。

回應

回傳建立的節點,狀態碼為 201 若已存在相同 ID 的節點,則回傳 409

範例

curl -X POST https://api.pathors.com/v1/projects/{projectId}/pathway/nodes \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "node-booking",
    "position": { "x": 200, "y": 300 },
    "data": {
      "type": "prompt",
      "title": "Booking",
      "prompt": "Help the user complete their booking.",
      "tools": ["tool-uuid-1"]
    }
  }'