获取会话变量
curl --request GET \
--url https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables \
--header 'Authorization: Bearer <token>'import requests
url = "https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables', 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://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"limit": 20,
"has_more": false,
"data": [
{
"id": "6fa459ea-ee8a-3ca4-894e-db77e160355e",
"name": "order_context",
"value_type": "object",
"value": "{\"order_id\":\"ORDER-1001\",\"priority\":true}",
"description": "Current order context",
"created_at": 1787788800,
"updated_at": 1787788860
}
]
}部署环境
获取会话变量
GET
/
v2
/
conversations
/
{conversation_id}
/
variables
获取会话变量
curl --request GET \
--url https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables \
--header 'Authorization: Bearer <token>'import requests
url = "https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables', 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://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{deployed_api_base_url}/v2/conversations/{conversation_id}/variables")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"limit": 20,
"has_more": false,
"data": [
{
"id": "6fa459ea-ee8a-3ca4-894e-db77e160355e",
"name": "order_context",
"value_type": "object",
"value": "{\"order_id\":\"ORDER-1001\",\"priority\":true}",
"description": "Current order context",
"created_at": 1787788800,
"updated_at": 1787788860
}
]
}授权
查询参数
分页游标:当前页最后一个变量的 id。省略则获取第一页。
返回的记录数。
必填范围:
1 <= x <= 100返回名称中包含该文本的变量,不区分大小写。
Required string length:
1 - 255