Retrieve list of assets.
curl --request GET \
--url https://{tenant}/api/assets \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/assets"
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/assets', 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/assets",
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/assets"
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/assets")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/assets")
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[
{
"_id": "363634636164353135373135656333663739386262636433",
"data": {
"info": {
"title": "Our Sample OAS",
"version": "1.0.0"
},
"openapi": "3.0.3",
"paths": {
"/anything": {
"post": {
"operationId": "anythingpost",
"responses": {
"200": {
"description": "Post created"
}
}
}
}
},
"x-tyk-api-gateway": {
"middleware": {
"global": {
"cache": {
"cacheAllSafeRequests": true,
"enabled": true,
"timeout": 5
}
},
"operations": {
"anythingpost": {
"requestSizeLimit": {
"enabled": true,
"value": 100
}
}
}
}
}
},
"description": "My first template",
"id": "my-unique-template-id",
"kind": "oas-template",
"last_updated": "2024-05-21T17:18:57.294797+03:00",
"name": "my-template",
"org_id": "5e9d9544a1dcd60001d0ed20"
}
]{
"Message": "unsupported asset kind: 'oas-temp'",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/assets",
"Meta": null,
"Status": "Error"
}{
"Message": "error listing assets.",
"Meta": null,
"Status": "Error"
}Assets
Retrieve list of assets.
Retrieves all types of assets with optional kind filter.
GET
/
api
/
assets
Retrieve list of assets.
curl --request GET \
--url https://{tenant}/api/assets \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/assets"
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/assets', 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/assets",
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/assets"
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/assets")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/assets")
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[
{
"_id": "363634636164353135373135656333663739386262636433",
"data": {
"info": {
"title": "Our Sample OAS",
"version": "1.0.0"
},
"openapi": "3.0.3",
"paths": {
"/anything": {
"post": {
"operationId": "anythingpost",
"responses": {
"200": {
"description": "Post created"
}
}
}
}
},
"x-tyk-api-gateway": {
"middleware": {
"global": {
"cache": {
"cacheAllSafeRequests": true,
"enabled": true,
"timeout": 5
}
},
"operations": {
"anythingpost": {
"requestSizeLimit": {
"enabled": true,
"value": 100
}
}
}
}
}
},
"description": "My first template",
"id": "my-unique-template-id",
"kind": "oas-template",
"last_updated": "2024-05-21T17:18:57.294797+03:00",
"name": "my-template",
"org_id": "5e9d9544a1dcd60001d0ed20"
}
]{
"Message": "unsupported asset kind: 'oas-temp'",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/assets",
"Meta": null,
"Status": "Error"
}{
"Message": "error listing assets.",
"Meta": null,
"Status": "Error"
}Authorizations
The Tyk Dashboard API Access Credentials
Query Parameters
Filter assets by kind (optional).
Available options:
oas-template Response
templates fetched.
database id of asset
Example:
"659b9613a1ed7ef7afdccb9d"
Example:
{ "info": { "title": "Our Sample OAS", "version": "1.0.0" }, "openapi": "3.0.3", "paths": { "/anything": { "post": { "operationId": "anythingpost", "responses": { "200": { "description": "Post created" } } } } }, "x-tyk-api-gateway": { "middleware": { "global": { "cache": { "cacheAllSafeRequests": true, "enabled": true, "timeout": 5 } }, "operations": { "anythingpost": { "requestSizeLimit": { "enabled": true, "value": 100 } } } } } }
custom id of asset that can be provided while creation/updating.
Example:
"my-unique-template-id"
the asset type, which is set to oas-template
Available options:
oas-template Example:
"oas-template"
last updated time stamp
Example:
"2024-01-10T08:48:36.183Z"
human-readable name for the template
Was this page helpful?
⌘I