Query components with filtering, sorting and pagination
curl --request POST \
--url https://api.draftt.io/v1/component/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pageSize": 20,
"filter": {
"technology": {
"$eq": "k8s"
},
"region": {
"$eq": "us-east-1"
}
},
"sort": {
"createdAt": "desc"
},
"pageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19"
}
'import requests
url = "https://api.draftt.io/v1/component/query"
payload = {
"pageSize": 20,
"filter": {
"technology": { "$eq": "k8s" },
"region": { "$eq": "us-east-1" }
},
"sort": { "createdAt": "desc" },
"pageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19"
}
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: {technology: {$eq: 'k8s'}, region: {$eq: 'us-east-1'}},
sort: {createdAt: 'desc'},
pageToken: 'eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19'
})
};
fetch('https://api.draftt.io/v1/component/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/component/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' => [
'technology' => [
'$eq' => 'k8s'
],
'region' => [
'$eq' => 'us-east-1'
]
],
'sort' => [
'createdAt' => 'desc'
],
'pageToken' => 'eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19'
]),
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/component/query"
payload := strings.NewReader("{\n \"pageSize\": 20,\n \"filter\": {\n \"technology\": {\n \"$eq\": \"k8s\"\n },\n \"region\": {\n \"$eq\": \"us-east-1\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n },\n \"pageToken\": \"eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19\"\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/component/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pageSize\": 20,\n \"filter\": {\n \"technology\": {\n \"$eq\": \"k8s\"\n },\n \"region\": {\n \"$eq\": \"us-east-1\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n },\n \"pageToken\": \"eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftt.io/v1/component/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 \"technology\": {\n \"$eq\": \"k8s\"\n },\n \"region\": {\n \"$eq\": \"us-east-1\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n },\n \"pageToken\": \"eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19\"\n}"
response = http.request(request)
puts response.read_body{
"nextPageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19",
"items": [
{
"id": "456654",
"integrationId": "6",
"uniqueIdentifier": "arn:aws:rds:us-east-1:1234567:db:rds-dev-1",
"region": "us-east-1",
"vendor": "aws",
"technology": "rds",
"type": "rds-postgres",
"version": "14.10",
"hasAvailableDraftts": true,
"createdAt": "2024-05-06T11:25:50.750Z",
"updatedAt": "2024-09-09T14:36:11.531Z",
"tags": {
"Environment": "dev-us-east-1",
"Terraform": "true"
},
"customTags": {
"CostCenter": "engineering",
"Owner": "platform-team"
},
"details": {
"database": {
"lastActiveConnectionTime": "2024-09-09T14:36:11.531Z"
}
}
},
"..."
]
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Component
Query components with filtering, sorting and pagination
Query components with filtering, sorting and pagination
POST
/
component
/
query
Query components with filtering, sorting and pagination
curl --request POST \
--url https://api.draftt.io/v1/component/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pageSize": 20,
"filter": {
"technology": {
"$eq": "k8s"
},
"region": {
"$eq": "us-east-1"
}
},
"sort": {
"createdAt": "desc"
},
"pageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19"
}
'import requests
url = "https://api.draftt.io/v1/component/query"
payload = {
"pageSize": 20,
"filter": {
"technology": { "$eq": "k8s" },
"region": { "$eq": "us-east-1" }
},
"sort": { "createdAt": "desc" },
"pageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19"
}
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: {technology: {$eq: 'k8s'}, region: {$eq: 'us-east-1'}},
sort: {createdAt: 'desc'},
pageToken: 'eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19'
})
};
fetch('https://api.draftt.io/v1/component/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/component/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' => [
'technology' => [
'$eq' => 'k8s'
],
'region' => [
'$eq' => 'us-east-1'
]
],
'sort' => [
'createdAt' => 'desc'
],
'pageToken' => 'eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19'
]),
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/component/query"
payload := strings.NewReader("{\n \"pageSize\": 20,\n \"filter\": {\n \"technology\": {\n \"$eq\": \"k8s\"\n },\n \"region\": {\n \"$eq\": \"us-east-1\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n },\n \"pageToken\": \"eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19\"\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/component/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pageSize\": 20,\n \"filter\": {\n \"technology\": {\n \"$eq\": \"k8s\"\n },\n \"region\": {\n \"$eq\": \"us-east-1\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n },\n \"pageToken\": \"eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftt.io/v1/component/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 \"technology\": {\n \"$eq\": \"k8s\"\n },\n \"region\": {\n \"$eq\": \"us-east-1\"\n }\n },\n \"sort\": {\n \"createdAt\": \"desc\"\n },\n \"pageToken\": \"eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19\"\n}"
response = http.request(request)
puts response.read_body{
"nextPageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19",
"items": [
{
"id": "456654",
"integrationId": "6",
"uniqueIdentifier": "arn:aws:rds:us-east-1:1234567:db:rds-dev-1",
"region": "us-east-1",
"vendor": "aws",
"technology": "rds",
"type": "rds-postgres",
"version": "14.10",
"hasAvailableDraftts": true,
"createdAt": "2024-05-06T11:25:50.750Z",
"updatedAt": "2024-09-09T14:36:11.531Z",
"tags": {
"Environment": "dev-us-east-1",
"Terraform": "true"
},
"customTags": {
"CostCenter": "engineering",
"Owner": "platform-team"
},
"details": {
"database": {
"lastActiveConnectionTime": "2024-09-09T14:36:11.531Z"
}
}
},
"..."
]
}{
"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, integrationId, uniqueIdentifier, region, vendor, technology, type, version, hasAvailableDraftts, createdAt, updatedAt, tags, customTags, details Optional sorting options, if not passed will sort by creation date in ascending order, sorting by a non-unique value will sub-sort by a 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