Delete a policy
curl --request DELETE \
--url https://{host}/api/v3/policies/{id} \
--header 'X-Qanapi-Authorization: <api-key>'import requests
url = "https://{host}/api/v3/policies/{id}"
headers = {"X-Qanapi-Authorization": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-Qanapi-Authorization': '<api-key>'}};
fetch('https://{host}/api/v3/policies/{id}', 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://{host}/api/v3/policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-Qanapi-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/v3/policies/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Qanapi-Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://{host}/api/v3/policies/{id}")
.header("X-Qanapi-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/v3/policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Qanapi-Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "Unauthorized.",
"error": "Unauthenticated"
}{
"message": "Unauthorized.",
"error": "InvalidApiKeyException"
}{
"message": "Invalid permission to perform action",
"error": "AccessDenied"
}{
"message": "Resource not found.",
"error": "NotFound"
}Policies
Delete a policy
Requires policy:manage. Takes effect across every node at once.
Deleting a statement can only narrow what the principals it named can
reach, since the default with no statement is to refuse.
DELETE
/
api
/
v3
/
policies
/
{id}
Delete a policy
curl --request DELETE \
--url https://{host}/api/v3/policies/{id} \
--header 'X-Qanapi-Authorization: <api-key>'import requests
url = "https://{host}/api/v3/policies/{id}"
headers = {"X-Qanapi-Authorization": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-Qanapi-Authorization': '<api-key>'}};
fetch('https://{host}/api/v3/policies/{id}', 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://{host}/api/v3/policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-Qanapi-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/v3/policies/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Qanapi-Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://{host}/api/v3/policies/{id}")
.header("X-Qanapi-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/v3/policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Qanapi-Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "Unauthorized.",
"error": "Unauthenticated"
}{
"message": "Unauthorized.",
"error": "InvalidApiKeyException"
}{
"message": "Invalid permission to perform action",
"error": "AccessDenied"
}{
"message": "Resource not found.",
"error": "NotFound"
}Authorizations
ApiKeyAuthBearerAuth
A machine credential, qk_ followed by its secret. Only a hash of the
secret is stored, so a key is displayed exactly once, when it is created
or rotated. A key reaches only the configurations it is linked to.
It may also be sent as Authorization: Bearer qk_..., which is
recognised by the prefix.
Path Parameters
The policy statement's id.
Response
Deleted. No body.
⌘I