Update OAuth metadata,redirecturi,description and Policy ID
curl --request PUT \
--url https://{tenant}/tyk/oauth/clients/{apiID}/{keyName} \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"api_id": "b84fe1a04e5648927971c0557971565c",
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"description": "changed description sample",
"meta_data": {
"user_id": "362b3fb9a1d5e4f00017226f5"
},
"redirect_uri": "https://httpbin.org/ip",
"secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
}
'import requests
url = "https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}"
payload = {
"api_id": "b84fe1a04e5648927971c0557971565c",
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"description": "changed description sample",
"meta_data": { "user_id": "362b3fb9a1d5e4f00017226f5" },
"redirect_uri": "https://httpbin.org/ip",
"secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Tyk-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
api_id: 'b84fe1a04e5648927971c0557971565c',
client_id: '2a06b398c17f46908de3dffcb71ef87df',
description: 'changed description sample',
meta_data: {user_id: '362b3fb9a1d5e4f00017226f5'},
redirect_uri: 'https://httpbin.org/ip',
secret: 'MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0'
})
};
fetch('https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}', 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}/tyk/oauth/clients/{apiID}/{keyName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'api_id' => 'b84fe1a04e5648927971c0557971565c',
'client_id' => '2a06b398c17f46908de3dffcb71ef87df',
'description' => 'changed description sample',
'meta_data' => [
'user_id' => '362b3fb9a1d5e4f00017226f5'
],
'redirect_uri' => 'https://httpbin.org/ip',
'secret' => 'MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0'
]),
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}/tyk/oauth/clients/{apiID}/{keyName}"
payload := strings.NewReader("{\n \"api_id\": \"b84fe1a04e5648927971c0557971565c\",\n \"client_id\": \"2a06b398c17f46908de3dffcb71ef87df\",\n \"description\": \"changed description sample\",\n \"meta_data\": {\n \"user_id\": \"362b3fb9a1d5e4f00017226f5\"\n },\n \"redirect_uri\": \"https://httpbin.org/ip\",\n \"secret\": \"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"api_id\": \"b84fe1a04e5648927971c0557971565c\",\n \"client_id\": \"2a06b398c17f46908de3dffcb71ef87df\",\n \"description\": \"changed description sample\",\n \"meta_data\": {\n \"user_id\": \"362b3fb9a1d5e4f00017226f5\"\n },\n \"redirect_uri\": \"https://httpbin.org/ip\",\n \"secret\": \"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_id\": \"b84fe1a04e5648927971c0557971565c\",\n \"client_id\": \"2a06b398c17f46908de3dffcb71ef87df\",\n \"description\": \"changed description sample\",\n \"meta_data\": {\n \"user_id\": \"362b3fb9a1d5e4f00017226f5\"\n },\n \"redirect_uri\": \"https://httpbin.org/ip\",\n \"secret\": \"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0\"\n}"
response = http.request(request)
puts response.read_body{
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"description": "changed description sample",
"meta_data": {
"user_id": "362b3fb9a1d5e4f00017226f5"
},
"redirect_uri": "https://httpbin.org/ip",
"secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
}{
"message": "Policy access rights doesn't contain API this OAuth client belongs to",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}{
"message": "API doesn't exist",
"status": "error"
}{
"message": "Unmarshalling failed",
"status": "error"
}OAuth
Update OAuth metadata,redirecturi,description and Policy ID
Allows you to update the metadata,redirecturi,description and Policy ID for an OAuth client.
PUT
/
tyk
/
oauth
/
clients
/
{apiID}
/
{keyName}
Update OAuth metadata,redirecturi,description and Policy ID
curl --request PUT \
--url https://{tenant}/tyk/oauth/clients/{apiID}/{keyName} \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"api_id": "b84fe1a04e5648927971c0557971565c",
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"description": "changed description sample",
"meta_data": {
"user_id": "362b3fb9a1d5e4f00017226f5"
},
"redirect_uri": "https://httpbin.org/ip",
"secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
}
'import requests
url = "https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}"
payload = {
"api_id": "b84fe1a04e5648927971c0557971565c",
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"description": "changed description sample",
"meta_data": { "user_id": "362b3fb9a1d5e4f00017226f5" },
"redirect_uri": "https://httpbin.org/ip",
"secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Tyk-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
api_id: 'b84fe1a04e5648927971c0557971565c',
client_id: '2a06b398c17f46908de3dffcb71ef87df',
description: 'changed description sample',
meta_data: {user_id: '362b3fb9a1d5e4f00017226f5'},
redirect_uri: 'https://httpbin.org/ip',
secret: 'MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0'
})
};
fetch('https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}', 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}/tyk/oauth/clients/{apiID}/{keyName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'api_id' => 'b84fe1a04e5648927971c0557971565c',
'client_id' => '2a06b398c17f46908de3dffcb71ef87df',
'description' => 'changed description sample',
'meta_data' => [
'user_id' => '362b3fb9a1d5e4f00017226f5'
],
'redirect_uri' => 'https://httpbin.org/ip',
'secret' => 'MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0'
]),
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}/tyk/oauth/clients/{apiID}/{keyName}"
payload := strings.NewReader("{\n \"api_id\": \"b84fe1a04e5648927971c0557971565c\",\n \"client_id\": \"2a06b398c17f46908de3dffcb71ef87df\",\n \"description\": \"changed description sample\",\n \"meta_data\": {\n \"user_id\": \"362b3fb9a1d5e4f00017226f5\"\n },\n \"redirect_uri\": \"https://httpbin.org/ip\",\n \"secret\": \"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"api_id\": \"b84fe1a04e5648927971c0557971565c\",\n \"client_id\": \"2a06b398c17f46908de3dffcb71ef87df\",\n \"description\": \"changed description sample\",\n \"meta_data\": {\n \"user_id\": \"362b3fb9a1d5e4f00017226f5\"\n },\n \"redirect_uri\": \"https://httpbin.org/ip\",\n \"secret\": \"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/oauth/clients/{apiID}/{keyName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_id\": \"b84fe1a04e5648927971c0557971565c\",\n \"client_id\": \"2a06b398c17f46908de3dffcb71ef87df\",\n \"description\": \"changed description sample\",\n \"meta_data\": {\n \"user_id\": \"362b3fb9a1d5e4f00017226f5\"\n },\n \"redirect_uri\": \"https://httpbin.org/ip\",\n \"secret\": \"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0\"\n}"
response = http.request(request)
puts response.read_body{
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"description": "changed description sample",
"meta_data": {
"user_id": "362b3fb9a1d5e4f00017226f5"
},
"redirect_uri": "https://httpbin.org/ip",
"secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
}{
"message": "Policy access rights doesn't contain API this OAuth client belongs to",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}{
"message": "API doesn't exist",
"status": "error"
}{
"message": "Unmarshalling failed",
"status": "error"
}Authorizations
Api key
Body
application/json
Example:
"keyless"
Example:
"2a06b398c17f46908de3dffcb71ef87b"
Example:
"google client login"
Show child attributes
Show child attributes
Example:
"https://httpbin.org/ip"
Example:
"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
Response
OAuth client updated
Example:
"keyless"
Example:
"2a06b398c17f46908de3dffcb71ef87b"
Example:
"google client login"
Show child attributes
Show child attributes
Example:
"https://httpbin.org/ip"
Example:
"MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0"
Was this page helpful?
⌘I