Import APIs
curl --request POST \
--url https://{tenant}/admin/apis/import \
--header 'Admin-Auth: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"apis": [
{
"api_definition": {
"api_id": "5fa2db834e07444f760b7ceb314209fb",
"name": "API 2"
},
"hook_references": [],
"is_streams": false,
"sort_by": 0
}
]
}
'import requests
url = "https://{tenant}/admin/apis/import"
payload = { "apis": [
{
"api_definition": {
"api_id": "5fa2db834e07444f760b7ceb314209fb",
"name": "API 2"
},
"hook_references": [],
"is_streams": False,
"sort_by": 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({
apis: [
{
api_definition: {api_id: '5fa2db834e07444f760b7ceb314209fb', name: 'API 2'},
hook_references: [],
is_streams: false,
sort_by: 0
}
]
})
};
fetch('https://{tenant}/admin/apis/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/apis/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([
'apis' => [
[
'api_definition' => [
'api_id' => '5fa2db834e07444f760b7ceb314209fb',
'name' => 'API 2'
],
'hook_references' => [
],
'is_streams' => false,
'sort_by' => 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/apis/import"
payload := strings.NewReader("{\n \"apis\": [\n {\n \"api_definition\": {\n \"api_id\": \"5fa2db834e07444f760b7ceb314209fb\",\n \"name\": \"API 2\"\n },\n \"hook_references\": [],\n \"is_streams\": false,\n \"sort_by\": 0\n }\n ]\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/apis/import")
.header("Admin-Auth", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"apis\": [\n {\n \"api_definition\": {\n \"api_id\": \"5fa2db834e07444f760b7ceb314209fb\",\n \"name\": \"API 2\"\n },\n \"hook_references\": [],\n \"is_streams\": false,\n \"sort_by\": 0\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/admin/apis/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 \"apis\": [\n {\n \"api_definition\": {\n \"api_id\": \"5fa2db834e07444f760b7ceb314209fb\",\n \"name\": \"API 2\"\n },\n \"hook_references\": [],\n \"is_streams\": false,\n \"sort_by\": 0\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"Message": "APIs imported",
"Meta": {
"5fa2db834e07444f760b7ceb314209fb": true,
"7a6ddeca9244448a4233866938a0d6e2": 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 APIs
The import APIs operates on lists of APIs.
POST
/
admin
/
apis
/
import
Import APIs
curl --request POST \
--url https://{tenant}/admin/apis/import \
--header 'Admin-Auth: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"apis": [
{
"api_definition": {
"api_id": "5fa2db834e07444f760b7ceb314209fb",
"name": "API 2"
},
"hook_references": [],
"is_streams": false,
"sort_by": 0
}
]
}
'import requests
url = "https://{tenant}/admin/apis/import"
payload = { "apis": [
{
"api_definition": {
"api_id": "5fa2db834e07444f760b7ceb314209fb",
"name": "API 2"
},
"hook_references": [],
"is_streams": False,
"sort_by": 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({
apis: [
{
api_definition: {api_id: '5fa2db834e07444f760b7ceb314209fb', name: 'API 2'},
hook_references: [],
is_streams: false,
sort_by: 0
}
]
})
};
fetch('https://{tenant}/admin/apis/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/apis/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([
'apis' => [
[
'api_definition' => [
'api_id' => '5fa2db834e07444f760b7ceb314209fb',
'name' => 'API 2'
],
'hook_references' => [
],
'is_streams' => false,
'sort_by' => 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/apis/import"
payload := strings.NewReader("{\n \"apis\": [\n {\n \"api_definition\": {\n \"api_id\": \"5fa2db834e07444f760b7ceb314209fb\",\n \"name\": \"API 2\"\n },\n \"hook_references\": [],\n \"is_streams\": false,\n \"sort_by\": 0\n }\n ]\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/apis/import")
.header("Admin-Auth", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"apis\": [\n {\n \"api_definition\": {\n \"api_id\": \"5fa2db834e07444f760b7ceb314209fb\",\n \"name\": \"API 2\"\n },\n \"hook_references\": [],\n \"is_streams\": false,\n \"sort_by\": 0\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/admin/apis/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 \"apis\": [\n {\n \"api_definition\": {\n \"api_id\": \"5fa2db834e07444f760b7ceb314209fb\",\n \"name\": \"API 2\"\n },\n \"hook_references\": [],\n \"is_streams\": false,\n \"sort_by\": 0\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"Message": "APIs imported",
"Meta": {
"5fa2db834e07444f760b7ceb314209fb": true,
"7a6ddeca9244448a4233866938a0d6e2": 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