Run batch request.
curl --request POST \
--url https://{tenant}/{listen_path}/tyk/batch \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"requests": [
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "1",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
},
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "2",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
}
],
"suppress_parallel_execution": false
}
'import requests
url = "https://{tenant}/{listen_path}/tyk/batch"
payload = {
"requests": [
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "1",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
},
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "2",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
}
],
"suppress_parallel_execution": False
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tyk-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
requests: [
{
body: JSON.stringify(''),
headers: {
authorization: '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test': '1',
'x-tyk-version': '1.2'
},
method: 'GET',
relative_url: 'get'
},
{
body: JSON.stringify(''),
headers: {
authorization: '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test': '2',
'x-tyk-version': '1.2'
},
method: 'GET',
relative_url: 'get'
}
],
suppress_parallel_execution: false
})
};
fetch('https://{tenant}/{listen_path}/tyk/batch', 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}/{listen_path}/tyk/batch",
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([
'requests' => [
[
'body' => '',
'headers' => [
'authorization' => '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test' => '1',
'x-tyk-version' => '1.2'
],
'method' => 'GET',
'relative_url' => 'get'
],
[
'body' => '',
'headers' => [
'authorization' => '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test' => '2',
'x-tyk-version' => '1.2'
],
'method' => 'GET',
'relative_url' => 'get'
]
],
'suppress_parallel_execution' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Tyk-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/{listen_path}/tyk/batch"
payload := strings.NewReader("{\n \"requests\": [\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"1\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n },\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"2\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n }\n ],\n \"suppress_parallel_execution\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tyk-Authorization", "<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}/{listen_path}/tyk/batch")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"requests\": [\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"1\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n },\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"2\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n }\n ],\n \"suppress_parallel_execution\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/{listen_path}/tyk/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"requests\": [\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"1\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n },\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"2\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n }\n ],\n \"suppress_parallel_execution\": false\n}"
response = http.request(request)
puts response.read_body[
{
"body": "{\"message\": \"success\"}",
"code": 200,
"headers": {
"Access-Control-Allow-Credentials": [
"true"
],
"Content-Type": [
"application/json"
]
},
"relative_url": "get"
}
]{
"message": "Batch request malformed",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}Batch requests
Run batch request.
Endpoint to run batch request.
POST
/
{listen_path}
/
tyk
/
batch
Run batch request.
curl --request POST \
--url https://{tenant}/{listen_path}/tyk/batch \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"requests": [
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "1",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
},
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "2",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
}
],
"suppress_parallel_execution": false
}
'import requests
url = "https://{tenant}/{listen_path}/tyk/batch"
payload = {
"requests": [
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "1",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
},
{
"body": "",
"headers": {
"authorization": "1dbc83b9c431649d7698faa9797e2900f",
"x-tyk-test": "2",
"x-tyk-version": "1.2"
},
"method": "GET",
"relative_url": "get"
}
],
"suppress_parallel_execution": False
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tyk-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
requests: [
{
body: JSON.stringify(''),
headers: {
authorization: '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test': '1',
'x-tyk-version': '1.2'
},
method: 'GET',
relative_url: 'get'
},
{
body: JSON.stringify(''),
headers: {
authorization: '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test': '2',
'x-tyk-version': '1.2'
},
method: 'GET',
relative_url: 'get'
}
],
suppress_parallel_execution: false
})
};
fetch('https://{tenant}/{listen_path}/tyk/batch', 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}/{listen_path}/tyk/batch",
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([
'requests' => [
[
'body' => '',
'headers' => [
'authorization' => '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test' => '1',
'x-tyk-version' => '1.2'
],
'method' => 'GET',
'relative_url' => 'get'
],
[
'body' => '',
'headers' => [
'authorization' => '1dbc83b9c431649d7698faa9797e2900f',
'x-tyk-test' => '2',
'x-tyk-version' => '1.2'
],
'method' => 'GET',
'relative_url' => 'get'
]
],
'suppress_parallel_execution' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Tyk-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/{listen_path}/tyk/batch"
payload := strings.NewReader("{\n \"requests\": [\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"1\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n },\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"2\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n }\n ],\n \"suppress_parallel_execution\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tyk-Authorization", "<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}/{listen_path}/tyk/batch")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"requests\": [\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"1\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n },\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"2\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n }\n ],\n \"suppress_parallel_execution\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/{listen_path}/tyk/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"requests\": [\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"1\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n },\n {\n \"body\": \"\",\n \"headers\": {\n \"authorization\": \"1dbc83b9c431649d7698faa9797e2900f\",\n \"x-tyk-test\": \"2\",\n \"x-tyk-version\": \"1.2\"\n },\n \"method\": \"GET\",\n \"relative_url\": \"get\"\n }\n ],\n \"suppress_parallel_execution\": false\n}"
response = http.request(request)
puts response.read_body[
{
"body": "{\"message\": \"success\"}",
"code": 200,
"headers": {
"Access-Control-Allow-Credentials": [
"true"
],
"Content-Type": [
"application/json"
]
},
"relative_url": "get"
}
]{
"message": "Batch request malformed",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}Authorizations
Api key
Path Parameters
API listen path
Body
application/json
Was this page helpful?
⌘I