curl --request POST \
--url https://api.platform.infino.ws/v1/graph_facts/{database} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"sql": "SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20"
}
EOFimport requests
url = "https://api.platform.infino.ws/v1/graph_facts/{database}"
payload = { "sql": "SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sql: 'SELECT subject, relation, object, document FROM facts WHERE subject = \'Acme Corp\' LIMIT 20'
})
};
fetch('https://api.platform.infino.ws/v1/graph_facts/{database}', 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.platform.infino.ws/v1/graph_facts/{database}",
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([
'sql' => 'SELECT subject, relation, object, document FROM facts WHERE subject = \'Acme Corp\' LIMIT 20'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.platform.infino.ws/v1/graph_facts/{database}"
payload := strings.NewReader("{\n \"sql\": \"SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.platform.infino.ws/v1/graph_facts/{database}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sql\": \"SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.platform.infino.ws/v1/graph_facts/{database}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sql\": \"SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20\"\n}"
response = http.request(request)
puts response.read_body{
"rows": [
{
"subject": "Acme Corp",
"relation": "acquired",
"object": "Globex",
"document": "annual-report-2024"
}
]
}Query graph facts
The sweep a walk from a result cannot make: every fact about a subject,
a relation or a document, or matching some words, counted or listed. The
statement reads the facts table alone and names no table of the
database.
Preview: this route may change between releases. It needs the agent APIs enabled on your account, and answers 403 until they are.
curl --request POST \
--url https://api.platform.infino.ws/v1/graph_facts/{database} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"sql": "SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20"
}
EOFimport requests
url = "https://api.platform.infino.ws/v1/graph_facts/{database}"
payload = { "sql": "SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sql: 'SELECT subject, relation, object, document FROM facts WHERE subject = \'Acme Corp\' LIMIT 20'
})
};
fetch('https://api.platform.infino.ws/v1/graph_facts/{database}', 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.platform.infino.ws/v1/graph_facts/{database}",
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([
'sql' => 'SELECT subject, relation, object, document FROM facts WHERE subject = \'Acme Corp\' LIMIT 20'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.platform.infino.ws/v1/graph_facts/{database}"
payload := strings.NewReader("{\n \"sql\": \"SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.platform.infino.ws/v1/graph_facts/{database}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sql\": \"SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.platform.infino.ws/v1/graph_facts/{database}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sql\": \"SELECT subject, relation, object, document FROM facts WHERE subject = 'Acme Corp' LIMIT 20\"\n}"
response = http.request(request)
puts response.read_body{
"rows": [
{
"subject": "Acme Corp",
"relation": "acquired",
"object": "Globex",
"document": "annual-report-2024"
}
]
}Authorizations
Body
POST /v1/graph_facts/{database}: one SQL statement over the facts the
knowledge graph read from the database's text. It is the sweep a walk
from a result cannot make: every fact of a party, a relation, a
document, or matching some words, counted or listed. The facts are a
facts table kept beside the database and never in its catalog; the
statement reads that table and names no table of the database. An
unknown field is refused.
Response
The statement's rows. note says why there are none when the deployment builds no knowledge graph.
Was this page helpful?
