cURL
curl --request POST \
--url https://api.osohq.com/api/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fact": {
"predicate": "<string>",
"args": [
{
"type": "<string>",
"id": "<string>"
}
]
}
}
'import requests
url = "https://api.osohq.com/api/query"
payload = { "fact": {
"predicate": "<string>",
"args": [
{
"type": "<string>",
"id": "<string>"
}
]
} }
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({fact: {predicate: '<string>', args: [{type: '<string>', id: '<string>'}]}})
};
fetch('https://api.osohq.com/api/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.osohq.com/api/query"
payload := strings.NewReader("{\n \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\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.osohq.com/api/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osohq.com/api/query")
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 \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api.osohq.com/api/query");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);{
"results": [
{
"predicate": "<string>",
"args": [
{
"type": "<string>",
"id": "<string>"
}
]
}
]
}{
"message": "<string>"
}Check API
Post query
deprecated
Query v1: query for any predicate and any combination of concrete and wildcard arguments.
Unlike GET /facts, which only lists facts you’ve added to Oso Cloud, you can use POST /query to list derived information about any rule in your policy.
POST
/
query
cURL
curl --request POST \
--url https://api.osohq.com/api/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fact": {
"predicate": "<string>",
"args": [
{
"type": "<string>",
"id": "<string>"
}
]
}
}
'import requests
url = "https://api.osohq.com/api/query"
payload = { "fact": {
"predicate": "<string>",
"args": [
{
"type": "<string>",
"id": "<string>"
}
]
} }
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({fact: {predicate: '<string>', args: [{type: '<string>', id: '<string>'}]}})
};
fetch('https://api.osohq.com/api/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.osohq.com/api/query"
payload := strings.NewReader("{\n \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\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.osohq.com/api/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osohq.com/api/query")
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 \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api.osohq.com/api/query");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"fact\": {\n \"predicate\": \"<string>\",\n \"args\": [\n {\n \"type\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);{
"results": [
{
"predicate": "<string>",
"args": [
{
"type": "<string>",
"id": "<string>"
}
]
}
]
}{
"message": "<string>"
}Authorizations
Requires an API key to access.
Body
application/json
Response
Show child attributes
Show child attributes
Was this page helpful?
⌘I