Construire un paquet de contexte
curl -X POST "https://api.example.com/v1/context" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN (OrbitToken)" \
-d '{
"task": "example_string",
"space_ids": [
"example_string"
],
"max_cu": 3.14
}'
import requests
import json
url = "https://api.example.com/v1/context"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (OrbitToken)"
}
data = {
"task": "example_string",
"space_ids": [
"example_string"
],
"max_cu": 3.14
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.example.com/v1/context", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (OrbitToken)"
},
body: JSON.stringify({
"task": "example_string",
"space_ids": [
"example_string"
],
"max_cu": 3.14
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"task": "example_string",
"space_ids": [
"example_string"
],
"max_cu": 3.14
}`)
req, err := http.NewRequest("POST", "https://api.example.com/v1/context", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN (OrbitToken)")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.example.com/v1/context')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN (OrbitToken)'
request.body = '{
"task": "example_string",
"space_ids": [
"example_string"
],
"max_cu": 3.14
}'
response = http.request(request)
puts response.body
{
"pack_id": "example_string",
"cu_used": 3.14,
"fragments": [
{
"id": "example_string",
"space_id": "example_string",
"content": "example_string",
"source": "example_string",
"freshness": 3.14,
"confidence": 3.14,
"permissions": [
"example_string"
],
"contradiction_status": "none",
"cu": 3.14
}
]
}
POST
/v1/context
POST
Base URLstring
Target server for requests. Edit to use your own host.
Bearer Token (OrbitToken)
Bearer Tokenstring
RequiredBearer token (OrbitToken) - just enter the token, "Bearer" prefix will be added automatically
Content-Typestring
RequiredThe media type of the request body
Options: application/json
Request Preview
Response
Response will appear here after sending the request
Authentication
header
Authorizationstring
RequiredBearer token (OrbitToken). Authentication token required.
Responses
pack_idstring
cu_usednumber
fragmentsarray
Was this page helpful?