Query policies with filtering, sorting and pagination
curl --request POST \
--url https://api.draftt.io/v1/policy/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pageSize": 20,
"filter": {
"name": {
"$like": "End*"
}
},
"sort": {
"createdAt": "desc"
}
}
'import requests
url = "https://api.draftt.io/v1/policy/query"
payload = {
"pageSize": 20,
"filter": { "name": { "$like": "End*" } },
"sort": { "createdAt": "desc" }
}
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({pageSize: 20, filter: {name: {$like: 'End*'}}, sort: {createdAt: 'desc'}})
};
fetch('https://api.draftt.io/v1/policy/query', 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.draftt.io/v1/policy/query",
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([
'pageSize' => 20,
'filter' => [
'name' => [
'$like' => 'End*'
]
],
'sort' => [
'createdAt' => 'desc'
]
]),
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.draftt.io/v1/policy/query"
payload := strings.NewReader("{\n \"pageSize\": 20,\n \"filter\": {\n \"name\": {\n \"$like\": \"End*\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\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.draftt.io/v1/policy/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pageSize\": 20,\n \"filter\": {\n \"name\": {\n \"$like\": \"End*\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftt.io/v1/policy/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 \"pageSize\": 20,\n \"filter\": {\n \"name\": {\n \"$like\": \"End*\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"nextPageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsibmFtZSI6eyJkaXJlY3Rpb24iOiJhc2MifX19",
"items": [
{
"id": "1",
"name": "End Of Life",
"description": "All components should be in the supported version",
"createdAt": "2024-05-06T11:25:51.513Z",
"updatedAt": "2024-09-09T19:35:31.898Z"
},
"..."
]
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Policy
Query policies with filtering, sorting and pagination
Query policies with filtering, sorting and pagination
POST
/
policy
/
query
Query policies with filtering, sorting and pagination
curl --request POST \
--url https://api.draftt.io/v1/policy/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pageSize": 20,
"filter": {
"name": {
"$like": "End*"
}
},
"sort": {
"createdAt": "desc"
}
}
'import requests
url = "https://api.draftt.io/v1/policy/query"
payload = {
"pageSize": 20,
"filter": { "name": { "$like": "End*" } },
"sort": { "createdAt": "desc" }
}
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({pageSize: 20, filter: {name: {$like: 'End*'}}, sort: {createdAt: 'desc'}})
};
fetch('https://api.draftt.io/v1/policy/query', 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.draftt.io/v1/policy/query",
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([
'pageSize' => 20,
'filter' => [
'name' => [
'$like' => 'End*'
]
],
'sort' => [
'createdAt' => 'desc'
]
]),
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.draftt.io/v1/policy/query"
payload := strings.NewReader("{\n \"pageSize\": 20,\n \"filter\": {\n \"name\": {\n \"$like\": \"End*\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\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.draftt.io/v1/policy/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pageSize\": 20,\n \"filter\": {\n \"name\": {\n \"$like\": \"End*\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftt.io/v1/policy/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 \"pageSize\": 20,\n \"filter\": {\n \"name\": {\n \"$like\": \"End*\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"nextPageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsibmFtZSI6eyJkaXJlY3Rpb24iOiJhc2MifX19",
"items": [
{
"id": "1",
"name": "End Of Life",
"description": "All components should be in the supported version",
"createdAt": "2024-05-06T11:25:51.513Z",
"updatedAt": "2024-09-09T19:35:31.898Z"
},
"..."
]
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Show child attributes
Show child attributes
If empty - will return all fields, if passed will only return selected fields
Available options:
id, name, description, createdAt, updatedAt Optional sorting options, if not passed will sort by creation date in ascending order
Show child attributes
Show child attributes
Base64 token for pagination
Number of items to return per page
Required range:
1 <= x <= 1000