Get a single policy by ID.
curl --request GET \
--url https://{tenant}/api/portal/policies/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/portal/policies/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}/api/portal/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://{tenant}/api/portal/policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://{tenant}/api/portal/policies/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant}/api/portal/policies/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/portal/policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"access_rights": {
"Itachi API": {
"allowed_urls": [
{
"methods": [
"GET"
],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi API",
"disable_introspection": false,
"versions": [
"Default"
]
}
},
"active": true,
"hmac_enabled": false,
"is_inactive": false,
"key_expires_in": 2592000,
"max_query_depth": -1,
"meta_data": {
"email": "itachi@tyk.io",
"user_type": "mobile_user"
},
"name": "Sample policy",
"partitions": {
"acl": true,
"complexity": false,
"per_api": false,
"quota": true,
"rate_limit": true
},
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"tags": [
"security"
],
"throttle_interval": 10,
"throttle_retry_limit": 10
}{
"Message": "Invalid policy ID.",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/portal/policies/{id}",
"Meta": null,
"Status": "Error"
}{
"Message": "Could not retrieve portal object.",
"Meta": null,
"Status": "Error"
}{
"Message": "Failure creating data, please contact your administrator.",
"Meta": null,
"Status": "Error"
}Policies
Get a single policy by ID.
Get a policy by ID.
GET
/
api
/
portal
/
policies
/
{id}
Get a single policy by ID.
curl --request GET \
--url https://{tenant}/api/portal/policies/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/portal/policies/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}/api/portal/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://{tenant}/api/portal/policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://{tenant}/api/portal/policies/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant}/api/portal/policies/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/portal/policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"access_rights": {
"Itachi API": {
"allowed_urls": [
{
"methods": [
"GET"
],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi API",
"disable_introspection": false,
"versions": [
"Default"
]
}
},
"active": true,
"hmac_enabled": false,
"is_inactive": false,
"key_expires_in": 2592000,
"max_query_depth": -1,
"meta_data": {
"email": "itachi@tyk.io",
"user_type": "mobile_user"
},
"name": "Sample policy",
"partitions": {
"acl": true,
"complexity": false,
"per_api": false,
"quota": true,
"rate_limit": true
},
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"tags": [
"security"
],
"throttle_interval": 10,
"throttle_retry_limit": 10
}{
"Message": "Invalid policy ID.",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/portal/policies/{id}",
"Meta": null,
"Status": "Error"
}{
"Message": "Could not retrieve portal object.",
"Meta": null,
"Status": "Error"
}{
"Message": "Failure creating data, please contact your administrator.",
"Meta": null,
"Status": "Error"
}Authorizations
The Tyk Dashboard API Access Credentials
Path Parameters
ID of policy to get.
Response
Policy fetched.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
⌘I