Import Policies
curl --request POST \
--url https://{tenant}/admin/policies/import \
--header 'Admin-Auth: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"Data": [
{
"_id": "",
"access_rights": null,
"active": true,
"date_created": "0001-01-01T00:00:00Z",
"hmac_enabled": false,
"id": "",
"is_inactive": false,
"key_expires_in": 0,
"last_updated": "1478791603",
"max_query_depth": 0,
"meta_data": null,
"name": "Default",
"org_id": "53ac07777cbb8c2d53000002",
"partitions": {
"acl": false,
"complexity": false,
"per_api": false,
"quota": false,
"rate_limit": false
},
"per": 60,
"quota_max": -1,
"quota_renewal_rate": 3600,
"rate": 1000,
"smoothing": null,
"tags": [],
"throttle_interval": 0,
"throttle_retry_limit": 0
}
],
"Pages": 0
}
'import requests
url = "https://{tenant}/admin/policies/import"
payload = {
"Data": [
{
"_id": "",
"access_rights": None,
"active": True,
"date_created": "0001-01-01T00:00:00Z",
"hmac_enabled": False,
"id": "",
"is_inactive": False,
"key_expires_in": 0,
"last_updated": "1478791603",
"max_query_depth": 0,
"meta_data": None,
"name": "Default",
"org_id": "53ac07777cbb8c2d53000002",
"partitions": {
"acl": False,
"complexity": False,
"per_api": False,
"quota": False,
"rate_limit": False
},
"per": 60,
"quota_max": -1,
"quota_renewal_rate": 3600,
"rate": 1000,
"smoothing": None,
"tags": [],
"throttle_interval": 0,
"throttle_retry_limit": 0
}
],
"Pages": 0
}
headers = {
"Admin-Auth": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Admin-Auth': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Data: [
{
_id: '',
access_rights: null,
active: true,
date_created: '0001-01-01T00:00:00Z',
hmac_enabled: false,
id: '',
is_inactive: false,
key_expires_in: 0,
last_updated: '1478791603',
max_query_depth: 0,
meta_data: null,
name: 'Default',
org_id: '53ac07777cbb8c2d53000002',
partitions: {acl: false, complexity: false, per_api: false, quota: false, rate_limit: false},
per: 60,
quota_max: -1,
quota_renewal_rate: 3600,
rate: 1000,
smoothing: null,
tags: [],
throttle_interval: 0,
throttle_retry_limit: 0
}
],
Pages: 0
})
};
fetch('https://{tenant}/admin/policies/import', 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://{tenant}/admin/policies/import",
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([
'Data' => [
[
'_id' => '',
'access_rights' => null,
'active' => true,
'date_created' => '0001-01-01T00:00:00Z',
'hmac_enabled' => false,
'id' => '',
'is_inactive' => false,
'key_expires_in' => 0,
'last_updated' => '1478791603',
'max_query_depth' => 0,
'meta_data' => null,
'name' => 'Default',
'org_id' => '53ac07777cbb8c2d53000002',
'partitions' => [
'acl' => false,
'complexity' => false,
'per_api' => false,
'quota' => false,
'rate_limit' => false
],
'per' => 60,
'quota_max' => -1,
'quota_renewal_rate' => 3600,
'rate' => 1000,
'smoothing' => null,
'tags' => [
],
'throttle_interval' => 0,
'throttle_retry_limit' => 0
]
],
'Pages' => 0
]),
CURLOPT_HTTPHEADER => [
"Admin-Auth: <api-key>",
"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://{tenant}/admin/policies/import"
payload := strings.NewReader("{\n \"Data\": [\n {\n \"_id\": \"\",\n \"access_rights\": null,\n \"active\": true,\n \"date_created\": \"0001-01-01T00:00:00Z\",\n \"hmac_enabled\": false,\n \"id\": \"\",\n \"is_inactive\": false,\n \"key_expires_in\": 0,\n \"last_updated\": \"1478791603\",\n \"max_query_depth\": 0,\n \"meta_data\": null,\n \"name\": \"Default\",\n \"org_id\": \"53ac07777cbb8c2d53000002\",\n \"partitions\": {\n \"acl\": false,\n \"complexity\": false,\n \"per_api\": false,\n \"quota\": false,\n \"rate_limit\": false\n },\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"smoothing\": null,\n \"tags\": [],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n }\n ],\n \"Pages\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Admin-Auth", "<api-key>")
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://{tenant}/admin/policies/import")
.header("Admin-Auth", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Data\": [\n {\n \"_id\": \"\",\n \"access_rights\": null,\n \"active\": true,\n \"date_created\": \"0001-01-01T00:00:00Z\",\n \"hmac_enabled\": false,\n \"id\": \"\",\n \"is_inactive\": false,\n \"key_expires_in\": 0,\n \"last_updated\": \"1478791603\",\n \"max_query_depth\": 0,\n \"meta_data\": null,\n \"name\": \"Default\",\n \"org_id\": \"53ac07777cbb8c2d53000002\",\n \"partitions\": {\n \"acl\": false,\n \"complexity\": false,\n \"per_api\": false,\n \"quota\": false,\n \"rate_limit\": false\n },\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"smoothing\": null,\n \"tags\": [],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n }\n ],\n \"Pages\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/admin/policies/import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Admin-Auth"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Data\": [\n {\n \"_id\": \"\",\n \"access_rights\": null,\n \"active\": true,\n \"date_created\": \"0001-01-01T00:00:00Z\",\n \"hmac_enabled\": false,\n \"id\": \"\",\n \"is_inactive\": false,\n \"key_expires_in\": 0,\n \"last_updated\": \"1478791603\",\n \"max_query_depth\": 0,\n \"meta_data\": null,\n \"name\": \"Default\",\n \"org_id\": \"53ac07777cbb8c2d53000002\",\n \"partitions\": {\n \"acl\": false,\n \"complexity\": false,\n \"per_api\": false,\n \"quota\": false,\n \"rate_limit\": false\n },\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"smoothing\": null,\n \"tags\": [],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n }\n ],\n \"Pages\": 0\n}"
response = http.request(request)
puts response.read_body{
"Message": "Policies imported",
"Meta": {
"61df10078f11dd00097cb55f": true
},
"Status": "OK"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "Request body malformed",
"Meta": null,
"Status": "Error"
}{
"Message": "Failed to read response body, body empty",
"Meta": null,
"Status": "Error"
}Import
Import Policies
The import Policies operates on lists of Policies.
POST
/
admin
/
policies
/
import
Import Policies
curl --request POST \
--url https://{tenant}/admin/policies/import \
--header 'Admin-Auth: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"Data": [
{
"_id": "",
"access_rights": null,
"active": true,
"date_created": "0001-01-01T00:00:00Z",
"hmac_enabled": false,
"id": "",
"is_inactive": false,
"key_expires_in": 0,
"last_updated": "1478791603",
"max_query_depth": 0,
"meta_data": null,
"name": "Default",
"org_id": "53ac07777cbb8c2d53000002",
"partitions": {
"acl": false,
"complexity": false,
"per_api": false,
"quota": false,
"rate_limit": false
},
"per": 60,
"quota_max": -1,
"quota_renewal_rate": 3600,
"rate": 1000,
"smoothing": null,
"tags": [],
"throttle_interval": 0,
"throttle_retry_limit": 0
}
],
"Pages": 0
}
'import requests
url = "https://{tenant}/admin/policies/import"
payload = {
"Data": [
{
"_id": "",
"access_rights": None,
"active": True,
"date_created": "0001-01-01T00:00:00Z",
"hmac_enabled": False,
"id": "",
"is_inactive": False,
"key_expires_in": 0,
"last_updated": "1478791603",
"max_query_depth": 0,
"meta_data": None,
"name": "Default",
"org_id": "53ac07777cbb8c2d53000002",
"partitions": {
"acl": False,
"complexity": False,
"per_api": False,
"quota": False,
"rate_limit": False
},
"per": 60,
"quota_max": -1,
"quota_renewal_rate": 3600,
"rate": 1000,
"smoothing": None,
"tags": [],
"throttle_interval": 0,
"throttle_retry_limit": 0
}
],
"Pages": 0
}
headers = {
"Admin-Auth": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Admin-Auth': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Data: [
{
_id: '',
access_rights: null,
active: true,
date_created: '0001-01-01T00:00:00Z',
hmac_enabled: false,
id: '',
is_inactive: false,
key_expires_in: 0,
last_updated: '1478791603',
max_query_depth: 0,
meta_data: null,
name: 'Default',
org_id: '53ac07777cbb8c2d53000002',
partitions: {acl: false, complexity: false, per_api: false, quota: false, rate_limit: false},
per: 60,
quota_max: -1,
quota_renewal_rate: 3600,
rate: 1000,
smoothing: null,
tags: [],
throttle_interval: 0,
throttle_retry_limit: 0
}
],
Pages: 0
})
};
fetch('https://{tenant}/admin/policies/import', 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://{tenant}/admin/policies/import",
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([
'Data' => [
[
'_id' => '',
'access_rights' => null,
'active' => true,
'date_created' => '0001-01-01T00:00:00Z',
'hmac_enabled' => false,
'id' => '',
'is_inactive' => false,
'key_expires_in' => 0,
'last_updated' => '1478791603',
'max_query_depth' => 0,
'meta_data' => null,
'name' => 'Default',
'org_id' => '53ac07777cbb8c2d53000002',
'partitions' => [
'acl' => false,
'complexity' => false,
'per_api' => false,
'quota' => false,
'rate_limit' => false
],
'per' => 60,
'quota_max' => -1,
'quota_renewal_rate' => 3600,
'rate' => 1000,
'smoothing' => null,
'tags' => [
],
'throttle_interval' => 0,
'throttle_retry_limit' => 0
]
],
'Pages' => 0
]),
CURLOPT_HTTPHEADER => [
"Admin-Auth: <api-key>",
"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://{tenant}/admin/policies/import"
payload := strings.NewReader("{\n \"Data\": [\n {\n \"_id\": \"\",\n \"access_rights\": null,\n \"active\": true,\n \"date_created\": \"0001-01-01T00:00:00Z\",\n \"hmac_enabled\": false,\n \"id\": \"\",\n \"is_inactive\": false,\n \"key_expires_in\": 0,\n \"last_updated\": \"1478791603\",\n \"max_query_depth\": 0,\n \"meta_data\": null,\n \"name\": \"Default\",\n \"org_id\": \"53ac07777cbb8c2d53000002\",\n \"partitions\": {\n \"acl\": false,\n \"complexity\": false,\n \"per_api\": false,\n \"quota\": false,\n \"rate_limit\": false\n },\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"smoothing\": null,\n \"tags\": [],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n }\n ],\n \"Pages\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Admin-Auth", "<api-key>")
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://{tenant}/admin/policies/import")
.header("Admin-Auth", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Data\": [\n {\n \"_id\": \"\",\n \"access_rights\": null,\n \"active\": true,\n \"date_created\": \"0001-01-01T00:00:00Z\",\n \"hmac_enabled\": false,\n \"id\": \"\",\n \"is_inactive\": false,\n \"key_expires_in\": 0,\n \"last_updated\": \"1478791603\",\n \"max_query_depth\": 0,\n \"meta_data\": null,\n \"name\": \"Default\",\n \"org_id\": \"53ac07777cbb8c2d53000002\",\n \"partitions\": {\n \"acl\": false,\n \"complexity\": false,\n \"per_api\": false,\n \"quota\": false,\n \"rate_limit\": false\n },\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"smoothing\": null,\n \"tags\": [],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n }\n ],\n \"Pages\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/admin/policies/import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Admin-Auth"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Data\": [\n {\n \"_id\": \"\",\n \"access_rights\": null,\n \"active\": true,\n \"date_created\": \"0001-01-01T00:00:00Z\",\n \"hmac_enabled\": false,\n \"id\": \"\",\n \"is_inactive\": false,\n \"key_expires_in\": 0,\n \"last_updated\": \"1478791603\",\n \"max_query_depth\": 0,\n \"meta_data\": null,\n \"name\": \"Default\",\n \"org_id\": \"53ac07777cbb8c2d53000002\",\n \"partitions\": {\n \"acl\": false,\n \"complexity\": false,\n \"per_api\": false,\n \"quota\": false,\n \"rate_limit\": false\n },\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"smoothing\": null,\n \"tags\": [],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n }\n ],\n \"Pages\": 0\n}"
response = http.request(request)
puts response.read_body{
"Message": "Policies imported",
"Meta": {
"61df10078f11dd00097cb55f": true
},
"Status": "OK"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "Request body malformed",
"Meta": null,
"Status": "Error"
}{
"Message": "Failed to read response body, body empty",
"Meta": null,
"Status": "Error"
}Was this page helpful?
⌘I