AWS Key Management Service
POST
CancelKeyDeletion
{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion
HEADERS
X-Amz-Target
BODY json
{
"KeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion"
payload := strings.NewReader("{\n \"KeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"KeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion",
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([
'KeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion', [
'body' => '{
"KeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion"
payload = { "KeyId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion"
payload <- "{\n \"KeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion";
let payload = json!({"KeyId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": ""
}'
echo '{
"KeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["KeyId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.CancelKeyDeletion")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}
POST
ConnectCustomKeyStore
{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore
HEADERS
X-Amz-Target
BODY json
{
"CustomKeyStoreId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CustomKeyStoreId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CustomKeyStoreId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CustomKeyStoreId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CustomKeyStoreId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CustomKeyStoreId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore"
payload := strings.NewReader("{\n \"CustomKeyStoreId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 28
{
"CustomKeyStoreId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CustomKeyStoreId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CustomKeyStoreId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CustomKeyStoreId\": \"\"\n}")
.asString();
const data = JSON.stringify({
CustomKeyStoreId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CustomKeyStoreId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({CustomKeyStoreId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {CustomKeyStoreId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CustomKeyStoreId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CustomKeyStoreId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CustomKeyStoreId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore",
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([
'CustomKeyStoreId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore', [
'body' => '{
"CustomKeyStoreId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CustomKeyStoreId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CustomKeyStoreId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CustomKeyStoreId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore"
payload = { "CustomKeyStoreId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore"
payload <- "{\n \"CustomKeyStoreId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CustomKeyStoreId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CustomKeyStoreId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore";
let payload = json!({"CustomKeyStoreId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CustomKeyStoreId": ""
}'
echo '{
"CustomKeyStoreId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CustomKeyStoreId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["CustomKeyStoreId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ConnectCustomKeyStore")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
CreateAlias
{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias
HEADERS
X-Amz-Target
BODY json
{
"AliasName": "",
"TargetKeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:AliasName ""
:TargetKeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias"
payload := strings.NewReader("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 42
{
"AliasName": "",
"TargetKeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
AliasName: '',
TargetKeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {AliasName: '', TargetKeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"AliasName":"","TargetKeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "AliasName": "",\n "TargetKeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({AliasName: '', TargetKeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {AliasName: '', TargetKeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
AliasName: '',
TargetKeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {AliasName: '', TargetKeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"AliasName":"","TargetKeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"AliasName": @"",
@"TargetKeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias",
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([
'AliasName' => '',
'TargetKeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias', [
'body' => '{
"AliasName": "",
"TargetKeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'AliasName' => '',
'TargetKeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'AliasName' => '',
'TargetKeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AliasName": "",
"TargetKeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AliasName": "",
"TargetKeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias"
payload = {
"AliasName": "",
"TargetKeyId": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias"
payload <- "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias";
let payload = json!({
"AliasName": "",
"TargetKeyId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"AliasName": "",
"TargetKeyId": ""
}'
echo '{
"AliasName": "",
"TargetKeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "AliasName": "",\n "TargetKeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"AliasName": "",
"TargetKeyId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.CreateAlias")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
CreateCustomKeyStore
{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore
HEADERS
X-Amz-Target
BODY json
{
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CustomKeyStoreName ""
:CloudHsmClusterId ""
:TrustAnchorCertificate ""
:KeyStorePassword ""
:CustomKeyStoreType ""
:XksProxyUriEndpoint ""
:XksProxyUriPath ""
:XksProxyVpcEndpointServiceName ""
:XksProxyAuthenticationCredential ""
:XksProxyConnectivity ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore"
payload := strings.NewReader("{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 309
{
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
.asString();
const data = JSON.stringify({
CustomKeyStoreName: '',
CloudHsmClusterId: '',
TrustAnchorCertificate: '',
KeyStorePassword: '',
CustomKeyStoreType: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CustomKeyStoreName: '',
CloudHsmClusterId: '',
TrustAnchorCertificate: '',
KeyStorePassword: '',
CustomKeyStoreType: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreName":"","CloudHsmClusterId":"","TrustAnchorCertificate":"","KeyStorePassword":"","CustomKeyStoreType":"","XksProxyUriEndpoint":"","XksProxyUriPath":"","XksProxyVpcEndpointServiceName":"","XksProxyAuthenticationCredential":"","XksProxyConnectivity":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CustomKeyStoreName": "",\n "CloudHsmClusterId": "",\n "TrustAnchorCertificate": "",\n "KeyStorePassword": "",\n "CustomKeyStoreType": "",\n "XksProxyUriEndpoint": "",\n "XksProxyUriPath": "",\n "XksProxyVpcEndpointServiceName": "",\n "XksProxyAuthenticationCredential": "",\n "XksProxyConnectivity": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
CustomKeyStoreName: '',
CloudHsmClusterId: '',
TrustAnchorCertificate: '',
KeyStorePassword: '',
CustomKeyStoreType: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
CustomKeyStoreName: '',
CloudHsmClusterId: '',
TrustAnchorCertificate: '',
KeyStorePassword: '',
CustomKeyStoreType: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CustomKeyStoreName: '',
CloudHsmClusterId: '',
TrustAnchorCertificate: '',
KeyStorePassword: '',
CustomKeyStoreType: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CustomKeyStoreName: '',
CloudHsmClusterId: '',
TrustAnchorCertificate: '',
KeyStorePassword: '',
CustomKeyStoreType: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreName":"","CloudHsmClusterId":"","TrustAnchorCertificate":"","KeyStorePassword":"","CustomKeyStoreType":"","XksProxyUriEndpoint":"","XksProxyUriPath":"","XksProxyVpcEndpointServiceName":"","XksProxyAuthenticationCredential":"","XksProxyConnectivity":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CustomKeyStoreName": @"",
@"CloudHsmClusterId": @"",
@"TrustAnchorCertificate": @"",
@"KeyStorePassword": @"",
@"CustomKeyStoreType": @"",
@"XksProxyUriEndpoint": @"",
@"XksProxyUriPath": @"",
@"XksProxyVpcEndpointServiceName": @"",
@"XksProxyAuthenticationCredential": @"",
@"XksProxyConnectivity": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore",
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([
'CustomKeyStoreName' => '',
'CloudHsmClusterId' => '',
'TrustAnchorCertificate' => '',
'KeyStorePassword' => '',
'CustomKeyStoreType' => '',
'XksProxyUriEndpoint' => '',
'XksProxyUriPath' => '',
'XksProxyVpcEndpointServiceName' => '',
'XksProxyAuthenticationCredential' => '',
'XksProxyConnectivity' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore', [
'body' => '{
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CustomKeyStoreName' => '',
'CloudHsmClusterId' => '',
'TrustAnchorCertificate' => '',
'KeyStorePassword' => '',
'CustomKeyStoreType' => '',
'XksProxyUriEndpoint' => '',
'XksProxyUriPath' => '',
'XksProxyVpcEndpointServiceName' => '',
'XksProxyAuthenticationCredential' => '',
'XksProxyConnectivity' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CustomKeyStoreName' => '',
'CloudHsmClusterId' => '',
'TrustAnchorCertificate' => '',
'KeyStorePassword' => '',
'CustomKeyStoreType' => '',
'XksProxyUriEndpoint' => '',
'XksProxyUriPath' => '',
'XksProxyVpcEndpointServiceName' => '',
'XksProxyAuthenticationCredential' => '',
'XksProxyConnectivity' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore"
payload = {
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore"
payload <- "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CustomKeyStoreName\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"TrustAnchorCertificate\": \"\",\n \"KeyStorePassword\": \"\",\n \"CustomKeyStoreType\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore";
let payload = json!({
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}'
echo '{
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CustomKeyStoreName": "",\n "CloudHsmClusterId": "",\n "TrustAnchorCertificate": "",\n "KeyStorePassword": "",\n "CustomKeyStoreType": "",\n "XksProxyUriEndpoint": "",\n "XksProxyUriPath": "",\n "XksProxyVpcEndpointServiceName": "",\n "XksProxyAuthenticationCredential": "",\n "XksProxyConnectivity": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"CustomKeyStoreName": "",
"CloudHsmClusterId": "",
"TrustAnchorCertificate": "",
"KeyStorePassword": "",
"CustomKeyStoreType": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.CreateCustomKeyStore")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"CustomKeyStoreId": "cks-987654321abcdef0"
}
POST
CreateGrant
{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:GranteePrincipal ""
:RetiringPrincipal ""
:Operations ""
:Constraints ""
:GrantTokens ""
:Name ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 146
{
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
GranteePrincipal: '',
RetiringPrincipal: '',
Operations: '',
Constraints: '',
GrantTokens: '',
Name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
GranteePrincipal: '',
RetiringPrincipal: '',
Operations: '',
Constraints: '',
GrantTokens: '',
Name: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GranteePrincipal":"","RetiringPrincipal":"","Operations":"","Constraints":"","GrantTokens":"","Name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "GranteePrincipal": "",\n "RetiringPrincipal": "",\n "Operations": "",\n "Constraints": "",\n "GrantTokens": "",\n "Name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
KeyId: '',
GranteePrincipal: '',
RetiringPrincipal: '',
Operations: '',
Constraints: '',
GrantTokens: '',
Name: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
KeyId: '',
GranteePrincipal: '',
RetiringPrincipal: '',
Operations: '',
Constraints: '',
GrantTokens: '',
Name: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
GranteePrincipal: '',
RetiringPrincipal: '',
Operations: '',
Constraints: '',
GrantTokens: '',
Name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
GranteePrincipal: '',
RetiringPrincipal: '',
Operations: '',
Constraints: '',
GrantTokens: '',
Name: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GranteePrincipal":"","RetiringPrincipal":"","Operations":"","Constraints":"","GrantTokens":"","Name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"GranteePrincipal": @"",
@"RetiringPrincipal": @"",
@"Operations": @"",
@"Constraints": @"",
@"GrantTokens": @"",
@"Name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant",
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([
'KeyId' => '',
'GranteePrincipal' => '',
'RetiringPrincipal' => '',
'Operations' => '',
'Constraints' => '',
'GrantTokens' => '',
'Name' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant', [
'body' => '{
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'GranteePrincipal' => '',
'RetiringPrincipal' => '',
'Operations' => '',
'Constraints' => '',
'GrantTokens' => '',
'Name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'GranteePrincipal' => '',
'RetiringPrincipal' => '',
'Operations' => '',
'Constraints' => '',
'GrantTokens' => '',
'Name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant"
payload = {
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant"
payload <- "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"GranteePrincipal\": \"\",\n \"RetiringPrincipal\": \"\",\n \"Operations\": \"\",\n \"Constraints\": \"\",\n \"GrantTokens\": \"\",\n \"Name\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant";
let payload = json!({
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}'
echo '{
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "GranteePrincipal": "",\n "RetiringPrincipal": "",\n "Operations": "",\n "Constraints": "",\n "GrantTokens": "",\n "Name": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"GranteePrincipal": "",
"RetiringPrincipal": "",
"Operations": "",
"Constraints": "",
"GrantTokens": "",
"Name": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.CreateGrant")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"GrantId": "0c237476b39f8bc44e45212e08498fbe3151305030726c0590dd8d3e9f3d6a60",
"GrantToken": "AQpAM2RhZTk1MGMyNTk2ZmZmMzEyYWVhOWViN2I1MWM4Mzc0MWFiYjc0ZDE1ODkyNGFlNTIzODZhMzgyZjBlNGY3NiKIAgEBAgB4Pa6VDCWW__MSrqnre1HIN0Grt00ViSSuUjhqOC8OT3YAAADfMIHcBgkqhkiG9w0BBwaggc4wgcsCAQAwgcUGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMmqLyBTAegIn9XlK5AgEQgIGXZQjkBcl1dykDdqZBUQ6L1OfUivQy7JVYO2-ZJP7m6f1g8GzV47HX5phdtONAP7K_HQIflcgpkoCqd_fUnE114mSmiagWkbQ5sqAVV3ov-VeqgrvMe5ZFEWLMSluvBAqdjHEdMIkHMlhlj4ENZbzBfo9Wxk8b8SnwP4kc4gGivedzFXo-dwN8fxjjq_ZZ9JFOj2ijIbj5FyogDCN0drOfi8RORSEuCEmPvjFRMFAwcmwFkN2NPp89amA"
}
POST
CreateKey
{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey
HEADERS
X-Amz-Target
BODY json
{
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:Policy ""
:Description ""
:KeyUsage ""
:CustomerMasterKeySpec ""
:KeySpec ""
:Origin ""
:CustomKeyStoreId ""
:BypassPolicyLockoutSafetyCheck ""
:Tags ""
:MultiRegion ""
:XksKeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey"
payload := strings.NewReader("{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 240
{
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
Policy: '',
Description: '',
KeyUsage: '',
CustomerMasterKeySpec: '',
KeySpec: '',
Origin: '',
CustomKeyStoreId: '',
BypassPolicyLockoutSafetyCheck: '',
Tags: '',
MultiRegion: '',
XksKeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
Policy: '',
Description: '',
KeyUsage: '',
CustomerMasterKeySpec: '',
KeySpec: '',
Origin: '',
CustomKeyStoreId: '',
BypassPolicyLockoutSafetyCheck: '',
Tags: '',
MultiRegion: '',
XksKeyId: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Policy":"","Description":"","KeyUsage":"","CustomerMasterKeySpec":"","KeySpec":"","Origin":"","CustomKeyStoreId":"","BypassPolicyLockoutSafetyCheck":"","Tags":"","MultiRegion":"","XksKeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Policy": "",\n "Description": "",\n "KeyUsage": "",\n "CustomerMasterKeySpec": "",\n "KeySpec": "",\n "Origin": "",\n "CustomKeyStoreId": "",\n "BypassPolicyLockoutSafetyCheck": "",\n "Tags": "",\n "MultiRegion": "",\n "XksKeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
Policy: '',
Description: '',
KeyUsage: '',
CustomerMasterKeySpec: '',
KeySpec: '',
Origin: '',
CustomKeyStoreId: '',
BypassPolicyLockoutSafetyCheck: '',
Tags: '',
MultiRegion: '',
XksKeyId: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
Policy: '',
Description: '',
KeyUsage: '',
CustomerMasterKeySpec: '',
KeySpec: '',
Origin: '',
CustomKeyStoreId: '',
BypassPolicyLockoutSafetyCheck: '',
Tags: '',
MultiRegion: '',
XksKeyId: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Policy: '',
Description: '',
KeyUsage: '',
CustomerMasterKeySpec: '',
KeySpec: '',
Origin: '',
CustomKeyStoreId: '',
BypassPolicyLockoutSafetyCheck: '',
Tags: '',
MultiRegion: '',
XksKeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
Policy: '',
Description: '',
KeyUsage: '',
CustomerMasterKeySpec: '',
KeySpec: '',
Origin: '',
CustomKeyStoreId: '',
BypassPolicyLockoutSafetyCheck: '',
Tags: '',
MultiRegion: '',
XksKeyId: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Policy":"","Description":"","KeyUsage":"","CustomerMasterKeySpec":"","KeySpec":"","Origin":"","CustomKeyStoreId":"","BypassPolicyLockoutSafetyCheck":"","Tags":"","MultiRegion":"","XksKeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Policy": @"",
@"Description": @"",
@"KeyUsage": @"",
@"CustomerMasterKeySpec": @"",
@"KeySpec": @"",
@"Origin": @"",
@"CustomKeyStoreId": @"",
@"BypassPolicyLockoutSafetyCheck": @"",
@"Tags": @"",
@"MultiRegion": @"",
@"XksKeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey",
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([
'Policy' => '',
'Description' => '',
'KeyUsage' => '',
'CustomerMasterKeySpec' => '',
'KeySpec' => '',
'Origin' => '',
'CustomKeyStoreId' => '',
'BypassPolicyLockoutSafetyCheck' => '',
'Tags' => '',
'MultiRegion' => '',
'XksKeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey', [
'body' => '{
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Policy' => '',
'Description' => '',
'KeyUsage' => '',
'CustomerMasterKeySpec' => '',
'KeySpec' => '',
'Origin' => '',
'CustomKeyStoreId' => '',
'BypassPolicyLockoutSafetyCheck' => '',
'Tags' => '',
'MultiRegion' => '',
'XksKeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Policy' => '',
'Description' => '',
'KeyUsage' => '',
'CustomerMasterKeySpec' => '',
'KeySpec' => '',
'Origin' => '',
'CustomKeyStoreId' => '',
'BypassPolicyLockoutSafetyCheck' => '',
'Tags' => '',
'MultiRegion' => '',
'XksKeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey"
payload = {
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey"
payload <- "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"Policy\": \"\",\n \"Description\": \"\",\n \"KeyUsage\": \"\",\n \"CustomerMasterKeySpec\": \"\",\n \"KeySpec\": \"\",\n \"Origin\": \"\",\n \"CustomKeyStoreId\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Tags\": \"\",\n \"MultiRegion\": \"\",\n \"XksKeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey";
let payload = json!({
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}'
echo '{
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "Policy": "",\n "Description": "",\n "KeyUsage": "",\n "CustomerMasterKeySpec": "",\n "KeySpec": "",\n "Origin": "",\n "CustomKeyStoreId": "",\n "BypassPolicyLockoutSafetyCheck": "",\n "Tags": "",\n "MultiRegion": "",\n "XksKeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"Policy": "",
"Description": "",
"KeyUsage": "",
"CustomerMasterKeySpec": "",
"KeySpec": "",
"Origin": "",
"CustomKeyStoreId": "",
"BypassPolicyLockoutSafetyCheck": "",
"Tags": "",
"MultiRegion": "",
"XksKeyId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.CreateKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyMetadata": {
"AWSAccountId": "111122223333",
"Arn": "arn:aws:kms:us-east-2:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321",
"CreationDate": "2022-02-02T07:48:55-07:00",
"CustomKeyStoreId": "cks-9876543210fedcba9",
"CustomerMasterKeySpec": "SYMMETRIC_DEFAULT",
"Description": "",
"Enabled": true,
"EncryptionAlgorithms": [
"SYMMETRIC_DEFAULT"
],
"KeyId": "0987dcba-09fe-87dc-65ba-ab0987654321",
"KeyManager": "CUSTOMER",
"KeySpec": "SYMMETRIC_DEFAULT",
"KeyState": "Enabled",
"KeyUsage": "ENCRYPT_DECRYPT",
"MultiRegion": false,
"Origin": "EXTERNAL_KEY_STORE",
"XksKeyConfiguration": {
"Id": "bb8562717f809024"
}
}
}
POST
Decrypt
{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt
HEADERS
X-Amz-Target
BODY json
{
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CiphertextBlob ""
:EncryptionContext ""
:GrantTokens ""
:KeyId ""
:EncryptionAlgorithm ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt"
payload := strings.NewReader("{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 118
{
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
.asString();
const data = JSON.stringify({
CiphertextBlob: '',
EncryptionContext: '',
GrantTokens: '',
KeyId: '',
EncryptionAlgorithm: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CiphertextBlob: '',
EncryptionContext: '',
GrantTokens: '',
KeyId: '',
EncryptionAlgorithm: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CiphertextBlob":"","EncryptionContext":"","GrantTokens":"","KeyId":"","EncryptionAlgorithm":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CiphertextBlob": "",\n "EncryptionContext": "",\n "GrantTokens": "",\n "KeyId": "",\n "EncryptionAlgorithm": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
CiphertextBlob: '',
EncryptionContext: '',
GrantTokens: '',
KeyId: '',
EncryptionAlgorithm: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
CiphertextBlob: '',
EncryptionContext: '',
GrantTokens: '',
KeyId: '',
EncryptionAlgorithm: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CiphertextBlob: '',
EncryptionContext: '',
GrantTokens: '',
KeyId: '',
EncryptionAlgorithm: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CiphertextBlob: '',
EncryptionContext: '',
GrantTokens: '',
KeyId: '',
EncryptionAlgorithm: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CiphertextBlob":"","EncryptionContext":"","GrantTokens":"","KeyId":"","EncryptionAlgorithm":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CiphertextBlob": @"",
@"EncryptionContext": @"",
@"GrantTokens": @"",
@"KeyId": @"",
@"EncryptionAlgorithm": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt",
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([
'CiphertextBlob' => '',
'EncryptionContext' => '',
'GrantTokens' => '',
'KeyId' => '',
'EncryptionAlgorithm' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt', [
'body' => '{
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CiphertextBlob' => '',
'EncryptionContext' => '',
'GrantTokens' => '',
'KeyId' => '',
'EncryptionAlgorithm' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CiphertextBlob' => '',
'EncryptionContext' => '',
'GrantTokens' => '',
'KeyId' => '',
'EncryptionAlgorithm' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt"
payload = {
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt"
payload <- "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CiphertextBlob\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"KeyId\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt";
let payload = json!({
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}'
echo '{
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CiphertextBlob": "",\n "EncryptionContext": "",\n "GrantTokens": "",\n "KeyId": "",\n "EncryptionAlgorithm": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"CiphertextBlob": "",
"EncryptionContext": "",
"GrantTokens": "",
"KeyId": "",
"EncryptionAlgorithm": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.Decrypt")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"Plaintext": ""
}
POST
DeleteAlias
{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias
HEADERS
X-Amz-Target
BODY json
{
"AliasName": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"AliasName\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:AliasName ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"AliasName\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"AliasName\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"AliasName\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias"
payload := strings.NewReader("{\n \"AliasName\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 21
{
"AliasName": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"AliasName\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"AliasName\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"AliasName\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"AliasName\": \"\"\n}")
.asString();
const data = JSON.stringify({
AliasName: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {AliasName: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"AliasName":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "AliasName": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"AliasName\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({AliasName: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {AliasName: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
AliasName: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {AliasName: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"AliasName":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"AliasName": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"AliasName\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias",
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([
'AliasName' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias', [
'body' => '{
"AliasName": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'AliasName' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'AliasName' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AliasName": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AliasName": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"AliasName\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias"
payload = { "AliasName": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias"
payload <- "{\n \"AliasName\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"AliasName\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"AliasName\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias";
let payload = json!({"AliasName": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"AliasName": ""
}'
echo '{
"AliasName": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "AliasName": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["AliasName": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteAlias")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
DeleteCustomKeyStore
{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore
HEADERS
X-Amz-Target
BODY json
{
"CustomKeyStoreId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CustomKeyStoreId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CustomKeyStoreId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CustomKeyStoreId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CustomKeyStoreId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CustomKeyStoreId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore"
payload := strings.NewReader("{\n \"CustomKeyStoreId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 28
{
"CustomKeyStoreId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CustomKeyStoreId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CustomKeyStoreId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CustomKeyStoreId\": \"\"\n}")
.asString();
const data = JSON.stringify({
CustomKeyStoreId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CustomKeyStoreId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({CustomKeyStoreId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {CustomKeyStoreId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CustomKeyStoreId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CustomKeyStoreId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CustomKeyStoreId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore",
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([
'CustomKeyStoreId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore', [
'body' => '{
"CustomKeyStoreId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CustomKeyStoreId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CustomKeyStoreId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CustomKeyStoreId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore"
payload = { "CustomKeyStoreId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore"
payload <- "{\n \"CustomKeyStoreId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CustomKeyStoreId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CustomKeyStoreId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore";
let payload = json!({"CustomKeyStoreId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CustomKeyStoreId": ""
}'
echo '{
"CustomKeyStoreId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CustomKeyStoreId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["CustomKeyStoreId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteCustomKeyStore")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
DeleteImportedKeyMaterial
{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial
HEADERS
X-Amz-Target
BODY json
{
"KeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial"
payload := strings.NewReader("{\n \"KeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"KeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial",
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([
'KeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial', [
'body' => '{
"KeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial"
payload = { "KeyId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial"
payload <- "{\n \"KeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial";
let payload = json!({"KeyId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": ""
}'
echo '{
"KeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["KeyId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DeleteImportedKeyMaterial")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
DescribeCustomKeyStores
{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores
HEADERS
X-Amz-Target
BODY json
{
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CustomKeyStoreId ""
:CustomKeyStoreName ""
:Limit ""
:Marker ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores"
payload := strings.NewReader("{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 87
{
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.asString();
const data = JSON.stringify({
CustomKeyStoreId: '',
CustomKeyStoreName: '',
Limit: '',
Marker: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: '', CustomKeyStoreName: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":"","CustomKeyStoreName":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CustomKeyStoreId": "",\n "CustomKeyStoreName": "",\n "Limit": "",\n "Marker": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({CustomKeyStoreId: '', CustomKeyStoreName: '', Limit: '', Marker: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {CustomKeyStoreId: '', CustomKeyStoreName: '', Limit: '', Marker: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CustomKeyStoreId: '',
CustomKeyStoreName: '',
Limit: '',
Marker: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: '', CustomKeyStoreName: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":"","CustomKeyStoreName":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CustomKeyStoreId": @"",
@"CustomKeyStoreName": @"",
@"Limit": @"",
@"Marker": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores",
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([
'CustomKeyStoreId' => '',
'CustomKeyStoreName' => '',
'Limit' => '',
'Marker' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores', [
'body' => '{
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CustomKeyStoreId' => '',
'CustomKeyStoreName' => '',
'Limit' => '',
'Marker' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CustomKeyStoreId' => '',
'CustomKeyStoreName' => '',
'Limit' => '',
'Marker' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores"
payload = {
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores"
payload <- "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CustomKeyStoreId\": \"\",\n \"CustomKeyStoreName\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores";
let payload = json!({
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}'
echo '{
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CustomKeyStoreId": "",\n "CustomKeyStoreName": "",\n "Limit": "",\n "Marker": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"CustomKeyStoreId": "",
"CustomKeyStoreName": "",
"Limit": "",
"Marker": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeCustomKeyStores")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"CustomKeyStores": [
{
"ConnectionState": "CONNECTED",
"CreationDate": "1.643057863.842",
"CustomKeyStoreId": "cks-876543210fedcba98",
"CustomKeyStoreName": "ExampleVPCExternalKeyStore",
"CustomKeyStoreType": "EXTERNAL_KEY_STORE",
"XksProxyConfiguration": {
"AccessKeyId": "ABCDE12345670EXAMPLE",
"Connectivity": "VPC_ENDPOINT_SERVICE",
"UriEndpoint": "https://myproxy-private.xks.example.com",
"UriPath": "/example-prefix/kms/xks/v1",
"VpcEndpointServiceName": "com.amazonaws.vpce.us-east-1.vpce-svc-example1"
}
}
]
}
POST
DescribeKey
{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 38
{
"KeyId": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', GrantTokens: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', GrantTokens: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey",
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([
'KeyId' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey', [
'body' => '{
"KeyId": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey"
payload = {
"KeyId": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey"
payload <- "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey";
let payload = json!({
"KeyId": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"GrantTokens": ""
}'
echo '{
"KeyId": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DescribeKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyMetadata": {
"AWSAccountId": "123456789012",
"Arn": "arn:aws:kms:us-west-2:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"CreationDate": 1646160362.664,
"CustomKeyStoreId": "cks-1234567890abcdef0",
"CustomerMasterKeySpec": "SYMMETRIC_DEFAULT",
"Description": "External key store test key",
"Enabled": true,
"EncryptionAlgorithms": [
"SYMMETRIC_DEFAULT"
],
"KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab",
"KeyManager": "CUSTOMER",
"KeySpec": "SYMMETRIC_DEFAULT",
"KeyState": "Enabled",
"KeyUsage": "ENCRYPT_DECRYPT",
"MultiRegion": false,
"Origin": "EXTERNAL_KEY_STORE",
"XksKeyConfiguration": {
"Id": "bb8562717f809024"
}
}
}
POST
DisableKey
{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey
HEADERS
X-Amz-Target
BODY json
{
"KeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey"
payload := strings.NewReader("{\n \"KeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"KeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey",
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([
'KeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey', [
'body' => '{
"KeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey"
payload = { "KeyId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey"
payload <- "{\n \"KeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey";
let payload = json!({"KeyId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": ""
}'
echo '{
"KeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["KeyId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
DisableKeyRotation
{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation
HEADERS
X-Amz-Target
BODY json
{
"KeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation"
payload := strings.NewReader("{\n \"KeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"KeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation",
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([
'KeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation', [
'body' => '{
"KeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation"
payload = { "KeyId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation"
payload <- "{\n \"KeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation";
let payload = json!({"KeyId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": ""
}'
echo '{
"KeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["KeyId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DisableKeyRotation")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
DisconnectCustomKeyStore
{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore
HEADERS
X-Amz-Target
BODY json
{
"CustomKeyStoreId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CustomKeyStoreId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CustomKeyStoreId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CustomKeyStoreId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CustomKeyStoreId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CustomKeyStoreId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore"
payload := strings.NewReader("{\n \"CustomKeyStoreId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 28
{
"CustomKeyStoreId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CustomKeyStoreId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CustomKeyStoreId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CustomKeyStoreId\": \"\"\n}")
.asString();
const data = JSON.stringify({
CustomKeyStoreId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CustomKeyStoreId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({CustomKeyStoreId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {CustomKeyStoreId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CustomKeyStoreId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CustomKeyStoreId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CustomKeyStoreId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore",
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([
'CustomKeyStoreId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore', [
'body' => '{
"CustomKeyStoreId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CustomKeyStoreId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CustomKeyStoreId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CustomKeyStoreId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore"
payload = { "CustomKeyStoreId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore"
payload <- "{\n \"CustomKeyStoreId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CustomKeyStoreId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CustomKeyStoreId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore";
let payload = json!({"CustomKeyStoreId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CustomKeyStoreId": ""
}'
echo '{
"CustomKeyStoreId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CustomKeyStoreId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["CustomKeyStoreId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.DisconnectCustomKeyStore")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
EnableKey
{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey
HEADERS
X-Amz-Target
BODY json
{
"KeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey"
payload := strings.NewReader("{\n \"KeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"KeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey",
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([
'KeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey', [
'body' => '{
"KeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey"
payload = { "KeyId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey"
payload <- "{\n \"KeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey";
let payload = json!({"KeyId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": ""
}'
echo '{
"KeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["KeyId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
EnableKeyRotation
{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation
HEADERS
X-Amz-Target
BODY json
{
"KeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation"
payload := strings.NewReader("{\n \"KeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"KeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation",
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([
'KeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation', [
'body' => '{
"KeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation"
payload = { "KeyId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation"
payload <- "{\n \"KeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation";
let payload = json!({"KeyId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": ""
}'
echo '{
"KeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["KeyId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.EnableKeyRotation")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Encrypt
{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Plaintext ""
:EncryptionContext ""
:GrantTokens ""
:EncryptionAlgorithm ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 113
{
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Plaintext: '',
EncryptionContext: '',
GrantTokens: '',
EncryptionAlgorithm: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
Plaintext: '',
EncryptionContext: '',
GrantTokens: '',
EncryptionAlgorithm: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Plaintext":"","EncryptionContext":"","GrantTokens":"","EncryptionAlgorithm":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Plaintext": "",\n "EncryptionContext": "",\n "GrantTokens": "",\n "EncryptionAlgorithm": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
KeyId: '',
Plaintext: '',
EncryptionContext: '',
GrantTokens: '',
EncryptionAlgorithm: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
KeyId: '',
Plaintext: '',
EncryptionContext: '',
GrantTokens: '',
EncryptionAlgorithm: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Plaintext: '',
EncryptionContext: '',
GrantTokens: '',
EncryptionAlgorithm: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
Plaintext: '',
EncryptionContext: '',
GrantTokens: '',
EncryptionAlgorithm: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Plaintext":"","EncryptionContext":"","GrantTokens":"","EncryptionAlgorithm":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Plaintext": @"",
@"EncryptionContext": @"",
@"GrantTokens": @"",
@"EncryptionAlgorithm": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt",
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([
'KeyId' => '',
'Plaintext' => '',
'EncryptionContext' => '',
'GrantTokens' => '',
'EncryptionAlgorithm' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt', [
'body' => '{
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Plaintext' => '',
'EncryptionContext' => '',
'GrantTokens' => '',
'EncryptionAlgorithm' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Plaintext' => '',
'EncryptionContext' => '',
'GrantTokens' => '',
'EncryptionAlgorithm' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt"
payload = {
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt"
payload <- "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Plaintext\": \"\",\n \"EncryptionContext\": \"\",\n \"GrantTokens\": \"\",\n \"EncryptionAlgorithm\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt";
let payload = json!({
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}'
echo '{
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Plaintext": "",\n "EncryptionContext": "",\n "GrantTokens": "",\n "EncryptionAlgorithm": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Plaintext": "",
"EncryptionContext": "",
"GrantTokens": "",
"EncryptionAlgorithm": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.Encrypt")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"CiphertextBlob": "",
"KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}
POST
GenerateDataKey
{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:EncryptionContext ""
:NumberOfBytes ""
:KeySpec ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
EncryptionContext: '',
NumberOfBytes: '',
KeySpec: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
EncryptionContext: '',
NumberOfBytes: '',
KeySpec: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","EncryptionContext":"","NumberOfBytes":"","KeySpec":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "EncryptionContext": "",\n "NumberOfBytes": "",\n "KeySpec": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
KeyId: '',
EncryptionContext: '',
NumberOfBytes: '',
KeySpec: '',
GrantTokens: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
KeyId: '',
EncryptionContext: '',
NumberOfBytes: '',
KeySpec: '',
GrantTokens: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
EncryptionContext: '',
NumberOfBytes: '',
KeySpec: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
EncryptionContext: '',
NumberOfBytes: '',
KeySpec: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","EncryptionContext":"","NumberOfBytes":"","KeySpec":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"EncryptionContext": @"",
@"NumberOfBytes": @"",
@"KeySpec": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey",
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([
'KeyId' => '',
'EncryptionContext' => '',
'NumberOfBytes' => '',
'KeySpec' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey', [
'body' => '{
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'EncryptionContext' => '',
'NumberOfBytes' => '',
'KeySpec' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'EncryptionContext' => '',
'NumberOfBytes' => '',
'KeySpec' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey"
payload = {
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey"
payload <- "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"NumberOfBytes\": \"\",\n \"KeySpec\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey";
let payload = json!({
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}'
echo '{
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "EncryptionContext": "",\n "NumberOfBytes": "",\n "KeySpec": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"EncryptionContext": "",
"NumberOfBytes": "",
"KeySpec": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"CiphertextBlob": "",
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"Plaintext": ""
}
POST
GenerateDataKeyPair
{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair
HEADERS
X-Amz-Target
BODY json
{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:EncryptionContext ""
:KeyId ""
:KeyPairSpec ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair"
payload := strings.NewReader("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 86
{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
EncryptionContext: '',
KeyId: '',
KeyPairSpec: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"EncryptionContext":"","KeyId":"","KeyPairSpec":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "EncryptionContext": "",\n "KeyId": "",\n "KeyPairSpec": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
EncryptionContext: '',
KeyId: '',
KeyPairSpec: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"EncryptionContext":"","KeyId":"","KeyPairSpec":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"EncryptionContext": @"",
@"KeyId": @"",
@"KeyPairSpec": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair",
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([
'EncryptionContext' => '',
'KeyId' => '',
'KeyPairSpec' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair', [
'body' => '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'EncryptionContext' => '',
'KeyId' => '',
'KeyPairSpec' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'EncryptionContext' => '',
'KeyId' => '',
'KeyPairSpec' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair"
payload = {
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair"
payload <- "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair";
let payload = json!({
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}'
echo '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "EncryptionContext": "",\n "KeyId": "",\n "KeyPairSpec": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPair")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"KeyPairSpec": "RSA_3072",
"PrivateKeyCiphertextBlob": "",
"PrivateKeyPlaintext": "",
"PublicKey": ""
}
POST
GenerateDataKeyPairWithoutPlaintext
{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext
HEADERS
X-Amz-Target
BODY json
{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:EncryptionContext ""
:KeyId ""
:KeyPairSpec ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext"
payload := strings.NewReader("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 86
{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
EncryptionContext: '',
KeyId: '',
KeyPairSpec: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"EncryptionContext":"","KeyId":"","KeyPairSpec":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "EncryptionContext": "",\n "KeyId": "",\n "KeyPairSpec": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
EncryptionContext: '',
KeyId: '',
KeyPairSpec: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {EncryptionContext: '', KeyId: '', KeyPairSpec: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"EncryptionContext":"","KeyId":"","KeyPairSpec":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"EncryptionContext": @"",
@"KeyId": @"",
@"KeyPairSpec": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext",
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([
'EncryptionContext' => '',
'KeyId' => '',
'KeyPairSpec' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext', [
'body' => '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'EncryptionContext' => '',
'KeyId' => '',
'KeyPairSpec' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'EncryptionContext' => '',
'KeyId' => '',
'KeyPairSpec' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext"
payload = {
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext"
payload <- "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"EncryptionContext\": \"\",\n \"KeyId\": \"\",\n \"KeyPairSpec\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext";
let payload = json!({
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}'
echo '{
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "EncryptionContext": "",\n "KeyId": "",\n "KeyPairSpec": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"EncryptionContext": "",
"KeyId": "",
"KeyPairSpec": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyPairWithoutPlaintext")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"KeyPairSpec": "ECC_NIST_P521",
"PrivateKeyCiphertextBlob": "",
"PublicKey": ""
}
POST
GenerateDataKeyWithoutPlaintext
{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:EncryptionContext ""
:KeySpec ""
:NumberOfBytes ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
EncryptionContext: '',
KeySpec: '',
NumberOfBytes: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
EncryptionContext: '',
KeySpec: '',
NumberOfBytes: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","EncryptionContext":"","KeySpec":"","NumberOfBytes":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "EncryptionContext": "",\n "KeySpec": "",\n "NumberOfBytes": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
KeyId: '',
EncryptionContext: '',
KeySpec: '',
NumberOfBytes: '',
GrantTokens: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
KeyId: '',
EncryptionContext: '',
KeySpec: '',
NumberOfBytes: '',
GrantTokens: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
EncryptionContext: '',
KeySpec: '',
NumberOfBytes: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
EncryptionContext: '',
KeySpec: '',
NumberOfBytes: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","EncryptionContext":"","KeySpec":"","NumberOfBytes":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"EncryptionContext": @"",
@"KeySpec": @"",
@"NumberOfBytes": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext",
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([
'KeyId' => '',
'EncryptionContext' => '',
'KeySpec' => '',
'NumberOfBytes' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext', [
'body' => '{
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'EncryptionContext' => '',
'KeySpec' => '',
'NumberOfBytes' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'EncryptionContext' => '',
'KeySpec' => '',
'NumberOfBytes' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext"
payload = {
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext"
payload <- "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"EncryptionContext\": \"\",\n \"KeySpec\": \"\",\n \"NumberOfBytes\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext";
let payload = json!({
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}'
echo '{
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "EncryptionContext": "",\n "KeySpec": "",\n "NumberOfBytes": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"EncryptionContext": "",
"KeySpec": "",
"NumberOfBytes": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateDataKeyWithoutPlaintext")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"CiphertextBlob": "",
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}
POST
GenerateMac
{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac
HEADERS
X-Amz-Target
BODY json
{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:Message ""
:KeyId ""
:MacAlgorithm ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac"
payload := strings.NewReader("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 77
{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
Message: '',
KeyId: '',
MacAlgorithm: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Message: '', KeyId: '', MacAlgorithm: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Message":"","KeyId":"","MacAlgorithm":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Message": "",\n "KeyId": "",\n "MacAlgorithm": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({Message: '', KeyId: '', MacAlgorithm: '', GrantTokens: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {Message: '', KeyId: '', MacAlgorithm: '', GrantTokens: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Message: '',
KeyId: '',
MacAlgorithm: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Message: '', KeyId: '', MacAlgorithm: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Message":"","KeyId":"","MacAlgorithm":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Message": @"",
@"KeyId": @"",
@"MacAlgorithm": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac",
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([
'Message' => '',
'KeyId' => '',
'MacAlgorithm' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac', [
'body' => '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Message' => '',
'KeyId' => '',
'MacAlgorithm' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Message' => '',
'KeyId' => '',
'MacAlgorithm' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac"
payload = {
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac"
payload <- "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac";
let payload = json!({
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}'
echo '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "Message": "",\n "KeyId": "",\n "MacAlgorithm": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateMac")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"Mac": "",
"MacAlgorithm": "HMAC_SHA_384"
}
POST
GenerateRandom
{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom
HEADERS
X-Amz-Target
BODY json
{
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:NumberOfBytes ""
:CustomKeyStoreId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom"
payload := strings.NewReader("{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 51
{
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}")
.asString();
const data = JSON.stringify({
NumberOfBytes: '',
CustomKeyStoreId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {NumberOfBytes: '', CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"NumberOfBytes":"","CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "NumberOfBytes": "",\n "CustomKeyStoreId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({NumberOfBytes: '', CustomKeyStoreId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {NumberOfBytes: '', CustomKeyStoreId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
NumberOfBytes: '',
CustomKeyStoreId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {NumberOfBytes: '', CustomKeyStoreId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"NumberOfBytes":"","CustomKeyStoreId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"NumberOfBytes": @"",
@"CustomKeyStoreId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom",
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([
'NumberOfBytes' => '',
'CustomKeyStoreId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom', [
'body' => '{
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'NumberOfBytes' => '',
'CustomKeyStoreId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'NumberOfBytes' => '',
'CustomKeyStoreId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom"
payload = {
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom"
payload <- "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"NumberOfBytes\": \"\",\n \"CustomKeyStoreId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom";
let payload = json!({
"NumberOfBytes": "",
"CustomKeyStoreId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}'
echo '{
"NumberOfBytes": "",
"CustomKeyStoreId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "NumberOfBytes": "",\n "CustomKeyStoreId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"NumberOfBytes": "",
"CustomKeyStoreId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GenerateRandom")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"Plaintext": ""
}
POST
GetKeyPolicy
{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"PolicyName": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:PolicyName ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 37
{
"KeyId": "",
"PolicyName": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
PolicyName: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PolicyName: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PolicyName":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "PolicyName": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', PolicyName: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', PolicyName: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
PolicyName: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PolicyName: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PolicyName":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"PolicyName": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy",
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([
'KeyId' => '',
'PolicyName' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy', [
'body' => '{
"KeyId": "",
"PolicyName": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'PolicyName' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'PolicyName' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PolicyName": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PolicyName": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy"
payload = {
"KeyId": "",
"PolicyName": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy"
payload <- "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy";
let payload = json!({
"KeyId": "",
"PolicyName": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"PolicyName": ""
}'
echo '{
"KeyId": "",
"PolicyName": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "PolicyName": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"PolicyName": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyPolicy")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"Policy": "{\n \"Version\" : \"2012-10-17\",\n \"Id\" : \"key-default-1\",\n \"Statement\" : [ {\n \"Sid\" : \"Enable IAM User Permissions\",\n \"Effect\" : \"Allow\",\n \"Principal\" : {\n \"AWS\" : \"arn:aws:iam::111122223333:root\"\n },\n \"Action\" : \"kms:*\",\n \"Resource\" : \"*\"\n } ]\n}"
}
POST
GetKeyRotationStatus
{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus
HEADERS
X-Amz-Target
BODY json
{
"KeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus"
payload := strings.NewReader("{\n \"KeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"KeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus",
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([
'KeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus', [
'body' => '{
"KeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus"
payload = { "KeyId": "" }
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus"
payload <- "{\n \"KeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus";
let payload = json!({"KeyId": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": ""
}'
echo '{
"KeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["KeyId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GetKeyRotationStatus")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyRotationEnabled": true
}
POST
GetParametersForImport
{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:WrappingAlgorithm ""
:WrappingKeySpec ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 69
{
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
WrappingAlgorithm: '',
WrappingKeySpec: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', WrappingAlgorithm: '', WrappingKeySpec: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","WrappingAlgorithm":"","WrappingKeySpec":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "WrappingAlgorithm": "",\n "WrappingKeySpec": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', WrappingAlgorithm: '', WrappingKeySpec: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', WrappingAlgorithm: '', WrappingKeySpec: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
WrappingAlgorithm: '',
WrappingKeySpec: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', WrappingAlgorithm: '', WrappingKeySpec: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","WrappingAlgorithm":"","WrappingKeySpec":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"WrappingAlgorithm": @"",
@"WrappingKeySpec": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport",
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([
'KeyId' => '',
'WrappingAlgorithm' => '',
'WrappingKeySpec' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport', [
'body' => '{
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'WrappingAlgorithm' => '',
'WrappingKeySpec' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'WrappingAlgorithm' => '',
'WrappingKeySpec' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport"
payload = {
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport"
payload <- "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"WrappingAlgorithm\": \"\",\n \"WrappingKeySpec\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport";
let payload = json!({
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}'
echo '{
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "WrappingAlgorithm": "",\n "WrappingKeySpec": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"WrappingAlgorithm": "",
"WrappingKeySpec": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GetParametersForImport")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"ImportToken": "",
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"ParametersValidTo": "2016-12-01T14:52:17-08:00",
"PublicKey": ""
}
POST
GetPublicKey
{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 38
{
"KeyId": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', GrantTokens: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', GrantTokens: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey",
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([
'KeyId' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey', [
'body' => '{
"KeyId": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey"
payload = {
"KeyId": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey"
payload <- "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey";
let payload = json!({
"KeyId": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"GrantTokens": ""
}'
echo '{
"KeyId": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.GetPublicKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"CustomerMasterKeySpec": "RSA_4096",
"EncryptionAlgorithms": [
"RSAES_OAEP_SHA_1",
"RSAES_OAEP_SHA_256"
],
"KeyId": "arn:aws:kms:us-west-2:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321",
"KeyUsage": "ENCRYPT_DECRYPT",
"PublicKey": ""
}
POST
ImportKeyMaterial
{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:ImportToken ""
:EncryptedKeyMaterial ""
:ValidTo ""
:ExpirationModel ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 110
{
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
ImportToken: '',
EncryptedKeyMaterial: '',
ValidTo: '',
ExpirationModel: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
ImportToken: '',
EncryptedKeyMaterial: '',
ValidTo: '',
ExpirationModel: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","ImportToken":"","EncryptedKeyMaterial":"","ValidTo":"","ExpirationModel":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "ImportToken": "",\n "EncryptedKeyMaterial": "",\n "ValidTo": "",\n "ExpirationModel": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
KeyId: '',
ImportToken: '',
EncryptedKeyMaterial: '',
ValidTo: '',
ExpirationModel: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
KeyId: '',
ImportToken: '',
EncryptedKeyMaterial: '',
ValidTo: '',
ExpirationModel: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
ImportToken: '',
EncryptedKeyMaterial: '',
ValidTo: '',
ExpirationModel: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
ImportToken: '',
EncryptedKeyMaterial: '',
ValidTo: '',
ExpirationModel: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","ImportToken":"","EncryptedKeyMaterial":"","ValidTo":"","ExpirationModel":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"ImportToken": @"",
@"EncryptedKeyMaterial": @"",
@"ValidTo": @"",
@"ExpirationModel": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial",
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([
'KeyId' => '',
'ImportToken' => '',
'EncryptedKeyMaterial' => '',
'ValidTo' => '',
'ExpirationModel' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial', [
'body' => '{
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'ImportToken' => '',
'EncryptedKeyMaterial' => '',
'ValidTo' => '',
'ExpirationModel' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'ImportToken' => '',
'EncryptedKeyMaterial' => '',
'ValidTo' => '',
'ExpirationModel' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial"
payload = {
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial"
payload <- "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"ImportToken\": \"\",\n \"EncryptedKeyMaterial\": \"\",\n \"ValidTo\": \"\",\n \"ExpirationModel\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial";
let payload = json!({
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}'
echo '{
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "ImportToken": "",\n "EncryptedKeyMaterial": "",\n "ValidTo": "",\n "ExpirationModel": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"ImportToken": "",
"EncryptedKeyMaterial": "",
"ValidTo": "",
"ExpirationModel": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ImportKeyMaterial")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ListAliases
{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Limit": "",
"Marker": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Limit ""
:Marker ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 48
{
"KeyId": "",
"Limit": "",
"Marker": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Limit: '',
Marker: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Limit": "",\n "Marker": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', Limit: '', Marker: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', Limit: '', Marker: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Limit: '',
Marker: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Limit": @"",
@"Marker": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases",
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([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases', [
'body' => '{
"KeyId": "",
"Limit": "",
"Marker": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases"
payload = {
"KeyId": "",
"Limit": "",
"Marker": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases"
payload <- "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases";
let payload = json!({
"KeyId": "",
"Limit": "",
"Marker": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
echo '{
"KeyId": "",
"Limit": "",
"Marker": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Limit": "",\n "Marker": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Limit": "",
"Marker": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ListAliases")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"Aliases": [
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/acm",
"AliasName": "alias/aws/acm",
"TargetKeyId": "da03f6f7-d279-427a-9cae-de48d07e5b66"
},
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/ebs",
"AliasName": "alias/aws/ebs",
"TargetKeyId": "25a217e7-7170-4b8c-8bf6-045ea5f70e5b"
},
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/rds",
"AliasName": "alias/aws/rds",
"TargetKeyId": "7ec3104e-c3f2-4b5c-bf42-bfc4772c6685"
},
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/redshift",
"AliasName": "alias/aws/redshift",
"TargetKeyId": "08f7a25a-69e2-4fb5-8f10-393db27326fa"
},
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/aws/s3",
"AliasName": "alias/aws/s3",
"TargetKeyId": "d2b0f1a3-580d-4f79-b836-bc983be8cfa5"
},
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/example1",
"AliasName": "alias/example1",
"TargetKeyId": "4da1e216-62d0-46c5-a7c0-5f3a3d2f8046"
},
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/example2",
"AliasName": "alias/example2",
"TargetKeyId": "f32fef59-2cc2-445b-8573-2d73328acbee"
},
{
"AliasArn": "arn:aws:kms:us-east-2:111122223333:alias/example3",
"AliasName": "alias/example3",
"TargetKeyId": "1374ef38-d34e-4d5f-b2c9-4e0daee38855"
}
],
"Truncated": false
}
POST
ListGrants
{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants
HEADERS
X-Amz-Target
BODY json
{
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:Limit ""
:Marker ""
:KeyId ""
:GrantId ""
:GranteePrincipal ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants"
payload := strings.NewReader("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 91
{
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}")
.asString();
const data = JSON.stringify({
Limit: '',
Marker: '',
KeyId: '',
GrantId: '',
GranteePrincipal: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Limit: '', Marker: '', KeyId: '', GrantId: '', GranteePrincipal: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Limit":"","Marker":"","KeyId":"","GrantId":"","GranteePrincipal":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Limit": "",\n "Marker": "",\n "KeyId": "",\n "GrantId": "",\n "GranteePrincipal": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({Limit: '', Marker: '', KeyId: '', GrantId: '', GranteePrincipal: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {Limit: '', Marker: '', KeyId: '', GrantId: '', GranteePrincipal: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Limit: '',
Marker: '',
KeyId: '',
GrantId: '',
GranteePrincipal: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Limit: '', Marker: '', KeyId: '', GrantId: '', GranteePrincipal: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Limit":"","Marker":"","KeyId":"","GrantId":"","GranteePrincipal":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Limit": @"",
@"Marker": @"",
@"KeyId": @"",
@"GrantId": @"",
@"GranteePrincipal": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants",
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([
'Limit' => '',
'Marker' => '',
'KeyId' => '',
'GrantId' => '',
'GranteePrincipal' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants', [
'body' => '{
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Limit' => '',
'Marker' => '',
'KeyId' => '',
'GrantId' => '',
'GranteePrincipal' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Limit' => '',
'Marker' => '',
'KeyId' => '',
'GrantId' => '',
'GranteePrincipal' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants"
payload = {
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants"
payload <- "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\",\n \"GranteePrincipal\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants";
let payload = json!({
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}'
echo '{
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "Limit": "",\n "Marker": "",\n "KeyId": "",\n "GrantId": "",\n "GranteePrincipal": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"Limit": "",
"Marker": "",
"KeyId": "",
"GrantId": "",
"GranteePrincipal": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ListGrants")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"Grants": [
{
"CreationDate": "2016-12-07T11:09:35-08:00",
"GrantId": "0c237476b39f8bc44e45212e08498fbe3151305030726c0590dd8d3e9f3d6a60",
"GranteePrincipal": "arn:aws:iam::111122223333:role/ExampleRole",
"IssuingAccount": "arn:aws:iam::444455556666:root",
"KeyId": "arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"Operations": [
"Decrypt",
"Encrypt"
],
"RetiringPrincipal": "arn:aws:iam::111122223333:role/ExampleRole"
}
],
"Truncated": false
}
POST
ListKeyPolicies
{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Limit": "",
"Marker": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Limit ""
:Marker ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 48
{
"KeyId": "",
"Limit": "",
"Marker": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Limit: '',
Marker: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Limit": "",\n "Marker": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', Limit: '', Marker: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', Limit: '', Marker: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Limit: '',
Marker: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Limit": @"",
@"Marker": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies",
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([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies', [
'body' => '{
"KeyId": "",
"Limit": "",
"Marker": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies"
payload = {
"KeyId": "",
"Limit": "",
"Marker": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies"
payload <- "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies";
let payload = json!({
"KeyId": "",
"Limit": "",
"Marker": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
echo '{
"KeyId": "",
"Limit": "",
"Marker": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Limit": "",\n "Marker": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Limit": "",
"Marker": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeyPolicies")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"PolicyNames": [
"default"
],
"Truncated": false
}
POST
ListKeys
{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys
HEADERS
X-Amz-Target
BODY json
{
"Limit": "",
"Marker": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:Limit ""
:Marker ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys"
payload := strings.NewReader("{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 33
{
"Limit": "",
"Marker": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.asString();
const data = JSON.stringify({
Limit: '',
Marker: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Limit": "",\n "Marker": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({Limit: '', Marker: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {Limit: '', Marker: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Limit: '',
Marker: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Limit": @"",
@"Marker": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys",
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([
'Limit' => '',
'Marker' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys', [
'body' => '{
"Limit": "",
"Marker": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Limit' => '',
'Marker' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Limit' => '',
'Marker' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Limit": "",
"Marker": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Limit": "",
"Marker": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys"
payload = {
"Limit": "",
"Marker": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys"
payload <- "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys";
let payload = json!({
"Limit": "",
"Marker": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"Limit": "",
"Marker": ""
}'
echo '{
"Limit": "",
"Marker": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "Limit": "",\n "Marker": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"Limit": "",
"Marker": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ListKeys")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"Keys": [
{
"KeyArn": "arn:aws:kms:us-east-2:111122223333:key/0d990263-018e-4e65-a703-eff731de951e",
"KeyId": "0d990263-018e-4e65-a703-eff731de951e"
},
{
"KeyArn": "arn:aws:kms:us-east-2:111122223333:key/144be297-0ae1-44ac-9c8f-93cd8c82f841",
"KeyId": "144be297-0ae1-44ac-9c8f-93cd8c82f841"
},
{
"KeyArn": "arn:aws:kms:us-east-2:111122223333:key/21184251-b765-428e-b852-2c7353e72571",
"KeyId": "21184251-b765-428e-b852-2c7353e72571"
},
{
"KeyArn": "arn:aws:kms:us-east-2:111122223333:key/214fe92f-5b03-4ae1-b350-db2a45dbe10c",
"KeyId": "214fe92f-5b03-4ae1-b350-db2a45dbe10c"
},
{
"KeyArn": "arn:aws:kms:us-east-2:111122223333:key/339963f2-e523-49d3-af24-a0fe752aa458",
"KeyId": "339963f2-e523-49d3-af24-a0fe752aa458"
},
{
"KeyArn": "arn:aws:kms:us-east-2:111122223333:key/b776a44b-df37-4438-9be4-a27494e4271a",
"KeyId": "b776a44b-df37-4438-9be4-a27494e4271a"
},
{
"KeyArn": "arn:aws:kms:us-east-2:111122223333:key/deaf6c9e-cf2c-46a6-bf6d-0b6d487cffbb",
"KeyId": "deaf6c9e-cf2c-46a6-bf6d-0b6d487cffbb"
}
],
"Truncated": false
}
POST
ListResourceTags
{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Limit": "",
"Marker": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Limit ""
:Marker ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 48
{
"KeyId": "",
"Limit": "",
"Marker": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Limit: '',
Marker: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Limit": "",\n "Marker": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', Limit: '', Marker: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', Limit: '', Marker: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Limit: '',
Marker: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Limit: '', Marker: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Limit":"","Marker":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Limit": @"",
@"Marker": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags",
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([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags', [
'body' => '{
"KeyId": "",
"Limit": "",
"Marker": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Limit' => '',
'Marker' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags"
payload = {
"KeyId": "",
"Limit": "",
"Marker": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags"
payload <- "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Limit\": \"\",\n \"Marker\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags";
let payload = json!({
"KeyId": "",
"Limit": "",
"Marker": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Limit": "",
"Marker": ""
}'
echo '{
"KeyId": "",
"Limit": "",
"Marker": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Limit": "",\n "Marker": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Limit": "",
"Marker": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ListResourceTags")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"Tags": [
{
"TagKey": "CostCenter",
"TagValue": "87654"
},
{
"TagKey": "CreatedBy",
"TagValue": "ExampleUser"
},
{
"TagKey": "Purpose",
"TagValue": "Test"
}
],
"Truncated": false
}
POST
ListRetirableGrants
{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants
HEADERS
X-Amz-Target
BODY json
{
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:Limit ""
:Marker ""
:RetiringPrincipal ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants"
payload := strings.NewReader("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 60
{
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}")
.asString();
const data = JSON.stringify({
Limit: '',
Marker: '',
RetiringPrincipal: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Limit: '', Marker: '', RetiringPrincipal: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Limit":"","Marker":"","RetiringPrincipal":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Limit": "",\n "Marker": "",\n "RetiringPrincipal": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({Limit: '', Marker: '', RetiringPrincipal: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {Limit: '', Marker: '', RetiringPrincipal: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Limit: '',
Marker: '',
RetiringPrincipal: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Limit: '', Marker: '', RetiringPrincipal: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Limit":"","Marker":"","RetiringPrincipal":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Limit": @"",
@"Marker": @"",
@"RetiringPrincipal": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants",
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([
'Limit' => '',
'Marker' => '',
'RetiringPrincipal' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants', [
'body' => '{
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Limit' => '',
'Marker' => '',
'RetiringPrincipal' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Limit' => '',
'Marker' => '',
'RetiringPrincipal' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants"
payload = {
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants"
payload <- "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"Limit\": \"\",\n \"Marker\": \"\",\n \"RetiringPrincipal\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants";
let payload = json!({
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}'
echo '{
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "Limit": "",\n "Marker": "",\n "RetiringPrincipal": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"Limit": "",
"Marker": "",
"RetiringPrincipal": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ListRetirableGrants")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"Grants": [
{
"CreationDate": "2016-12-07T11:09:35-08:00",
"GrantId": "0c237476b39f8bc44e45212e08498fbe3151305030726c0590dd8d3e9f3d6a60",
"GranteePrincipal": "arn:aws:iam::111122223333:role/ExampleRole",
"IssuingAccount": "arn:aws:iam::444455556666:root",
"KeyId": "arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"Operations": [
"Decrypt",
"Encrypt"
],
"RetiringPrincipal": "arn:aws:iam::111122223333:role/ExampleRole"
}
],
"Truncated": false
}
POST
PutKeyPolicy
{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:PolicyName ""
:Policy ""
:BypassPolicyLockoutSafetyCheck ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 93
{
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
PolicyName: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PolicyName: '', Policy: '', BypassPolicyLockoutSafetyCheck: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PolicyName":"","Policy":"","BypassPolicyLockoutSafetyCheck":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "PolicyName": "",\n "Policy": "",\n "BypassPolicyLockoutSafetyCheck": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', PolicyName: '', Policy: '', BypassPolicyLockoutSafetyCheck: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', PolicyName: '', Policy: '', BypassPolicyLockoutSafetyCheck: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
PolicyName: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PolicyName: '', Policy: '', BypassPolicyLockoutSafetyCheck: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PolicyName":"","Policy":"","BypassPolicyLockoutSafetyCheck":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"PolicyName": @"",
@"Policy": @"",
@"BypassPolicyLockoutSafetyCheck": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy",
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([
'KeyId' => '',
'PolicyName' => '',
'Policy' => '',
'BypassPolicyLockoutSafetyCheck' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy', [
'body' => '{
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'PolicyName' => '',
'Policy' => '',
'BypassPolicyLockoutSafetyCheck' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'PolicyName' => '',
'Policy' => '',
'BypassPolicyLockoutSafetyCheck' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy"
payload = {
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy"
payload <- "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"PolicyName\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy";
let payload = json!({
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}'
echo '{
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "PolicyName": "",\n "Policy": "",\n "BypassPolicyLockoutSafetyCheck": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"PolicyName": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.PutKeyPolicy")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ReEncrypt
{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt
HEADERS
X-Amz-Target
BODY json
{
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CiphertextBlob ""
:SourceEncryptionContext ""
:SourceKeyId ""
:DestinationKeyId ""
:DestinationEncryptionContext ""
:SourceEncryptionAlgorithm ""
:DestinationEncryptionAlgorithm ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt"
payload := strings.NewReader("{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 240
{
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
CiphertextBlob: '',
SourceEncryptionContext: '',
SourceKeyId: '',
DestinationKeyId: '',
DestinationEncryptionContext: '',
SourceEncryptionAlgorithm: '',
DestinationEncryptionAlgorithm: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CiphertextBlob: '',
SourceEncryptionContext: '',
SourceKeyId: '',
DestinationKeyId: '',
DestinationEncryptionContext: '',
SourceEncryptionAlgorithm: '',
DestinationEncryptionAlgorithm: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CiphertextBlob":"","SourceEncryptionContext":"","SourceKeyId":"","DestinationKeyId":"","DestinationEncryptionContext":"","SourceEncryptionAlgorithm":"","DestinationEncryptionAlgorithm":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CiphertextBlob": "",\n "SourceEncryptionContext": "",\n "SourceKeyId": "",\n "DestinationKeyId": "",\n "DestinationEncryptionContext": "",\n "SourceEncryptionAlgorithm": "",\n "DestinationEncryptionAlgorithm": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
CiphertextBlob: '',
SourceEncryptionContext: '',
SourceKeyId: '',
DestinationKeyId: '',
DestinationEncryptionContext: '',
SourceEncryptionAlgorithm: '',
DestinationEncryptionAlgorithm: '',
GrantTokens: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
CiphertextBlob: '',
SourceEncryptionContext: '',
SourceKeyId: '',
DestinationKeyId: '',
DestinationEncryptionContext: '',
SourceEncryptionAlgorithm: '',
DestinationEncryptionAlgorithm: '',
GrantTokens: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CiphertextBlob: '',
SourceEncryptionContext: '',
SourceKeyId: '',
DestinationKeyId: '',
DestinationEncryptionContext: '',
SourceEncryptionAlgorithm: '',
DestinationEncryptionAlgorithm: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CiphertextBlob: '',
SourceEncryptionContext: '',
SourceKeyId: '',
DestinationKeyId: '',
DestinationEncryptionContext: '',
SourceEncryptionAlgorithm: '',
DestinationEncryptionAlgorithm: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CiphertextBlob":"","SourceEncryptionContext":"","SourceKeyId":"","DestinationKeyId":"","DestinationEncryptionContext":"","SourceEncryptionAlgorithm":"","DestinationEncryptionAlgorithm":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CiphertextBlob": @"",
@"SourceEncryptionContext": @"",
@"SourceKeyId": @"",
@"DestinationKeyId": @"",
@"DestinationEncryptionContext": @"",
@"SourceEncryptionAlgorithm": @"",
@"DestinationEncryptionAlgorithm": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt",
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([
'CiphertextBlob' => '',
'SourceEncryptionContext' => '',
'SourceKeyId' => '',
'DestinationKeyId' => '',
'DestinationEncryptionContext' => '',
'SourceEncryptionAlgorithm' => '',
'DestinationEncryptionAlgorithm' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt', [
'body' => '{
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CiphertextBlob' => '',
'SourceEncryptionContext' => '',
'SourceKeyId' => '',
'DestinationKeyId' => '',
'DestinationEncryptionContext' => '',
'SourceEncryptionAlgorithm' => '',
'DestinationEncryptionAlgorithm' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CiphertextBlob' => '',
'SourceEncryptionContext' => '',
'SourceKeyId' => '',
'DestinationKeyId' => '',
'DestinationEncryptionContext' => '',
'SourceEncryptionAlgorithm' => '',
'DestinationEncryptionAlgorithm' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt"
payload = {
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt"
payload <- "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CiphertextBlob\": \"\",\n \"SourceEncryptionContext\": \"\",\n \"SourceKeyId\": \"\",\n \"DestinationKeyId\": \"\",\n \"DestinationEncryptionContext\": \"\",\n \"SourceEncryptionAlgorithm\": \"\",\n \"DestinationEncryptionAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt";
let payload = json!({
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}'
echo '{
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CiphertextBlob": "",\n "SourceEncryptionContext": "",\n "SourceKeyId": "",\n "DestinationKeyId": "",\n "DestinationEncryptionContext": "",\n "SourceEncryptionAlgorithm": "",\n "DestinationEncryptionAlgorithm": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"CiphertextBlob": "",
"SourceEncryptionContext": "",
"SourceKeyId": "",
"DestinationKeyId": "",
"DestinationEncryptionContext": "",
"SourceEncryptionAlgorithm": "",
"DestinationEncryptionAlgorithm": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ReEncrypt")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"CiphertextBlob": "",
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321",
"SourceKeyId": "arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}
POST
ReplicateKey
{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:ReplicaRegion ""
:Policy ""
:BypassPolicyLockoutSafetyCheck ""
:Description ""
:Tags ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 131
{
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
ReplicaRegion: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: '',
Description: '',
Tags: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
ReplicaRegion: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: '',
Description: '',
Tags: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","ReplicaRegion":"","Policy":"","BypassPolicyLockoutSafetyCheck":"","Description":"","Tags":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "ReplicaRegion": "",\n "Policy": "",\n "BypassPolicyLockoutSafetyCheck": "",\n "Description": "",\n "Tags": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
KeyId: '',
ReplicaRegion: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: '',
Description: '',
Tags: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
KeyId: '',
ReplicaRegion: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: '',
Description: '',
Tags: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
ReplicaRegion: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: '',
Description: '',
Tags: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
ReplicaRegion: '',
Policy: '',
BypassPolicyLockoutSafetyCheck: '',
Description: '',
Tags: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","ReplicaRegion":"","Policy":"","BypassPolicyLockoutSafetyCheck":"","Description":"","Tags":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"ReplicaRegion": @"",
@"Policy": @"",
@"BypassPolicyLockoutSafetyCheck": @"",
@"Description": @"",
@"Tags": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey",
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([
'KeyId' => '',
'ReplicaRegion' => '',
'Policy' => '',
'BypassPolicyLockoutSafetyCheck' => '',
'Description' => '',
'Tags' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey', [
'body' => '{
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'ReplicaRegion' => '',
'Policy' => '',
'BypassPolicyLockoutSafetyCheck' => '',
'Description' => '',
'Tags' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'ReplicaRegion' => '',
'Policy' => '',
'BypassPolicyLockoutSafetyCheck' => '',
'Description' => '',
'Tags' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey"
payload = {
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey"
payload <- "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"ReplicaRegion\": \"\",\n \"Policy\": \"\",\n \"BypassPolicyLockoutSafetyCheck\": \"\",\n \"Description\": \"\",\n \"Tags\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey";
let payload = json!({
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}'
echo '{
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "ReplicaRegion": "",\n "Policy": "",\n "BypassPolicyLockoutSafetyCheck": "",\n "Description": "",\n "Tags": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"ReplicaRegion": "",
"Policy": "",
"BypassPolicyLockoutSafetyCheck": "",
"Description": "",
"Tags": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ReplicateKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"ReplicaKeyMetadata": {
"AWSAccountId": "111122223333",
"Arn": "arn:aws:kms:us-west-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab",
"CreationDate": 1607472987.918,
"CustomerMasterKeySpec": "SYMMETRIC_DEFAULT",
"Description": "",
"Enabled": true,
"EncryptionAlgorithms": [
"SYMMETRIC_DEFAULT"
],
"KeyId": "mrk-1234abcd12ab34cd56ef1234567890ab",
"KeyManager": "CUSTOMER",
"KeyState": "Enabled",
"KeyUsage": "ENCRYPT_DECRYPT",
"MultiRegion": true,
"MultiRegionConfiguration": {
"MultiRegionKeyType": "REPLICA",
"PrimaryKey": {
"Arn": "arn:aws:kms:us-east-1:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab",
"Region": "us-east-1"
},
"ReplicaKeys": [
{
"Arn": "arn:aws:kms:us-west-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab",
"Region": "us-west-2"
}
]
},
"Origin": "AWS_KMS"
},
"ReplicaPolicy": "{\n \"Version\" : \"2012-10-17\",\n \"Id\" : \"key-default-1\",...}",
"ReplicaTags": []
}
POST
RetireGrant
{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant
HEADERS
X-Amz-Target
BODY json
{
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:GrantToken ""
:KeyId ""
:GrantId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant"
payload := strings.NewReader("{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 54
{
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
.asString();
const data = JSON.stringify({
GrantToken: '',
KeyId: '',
GrantId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {GrantToken: '', KeyId: '', GrantId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"GrantToken":"","KeyId":"","GrantId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "GrantToken": "",\n "KeyId": "",\n "GrantId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({GrantToken: '', KeyId: '', GrantId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {GrantToken: '', KeyId: '', GrantId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
GrantToken: '',
KeyId: '',
GrantId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {GrantToken: '', KeyId: '', GrantId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"GrantToken":"","KeyId":"","GrantId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"GrantToken": @"",
@"KeyId": @"",
@"GrantId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant",
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([
'GrantToken' => '',
'KeyId' => '',
'GrantId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant', [
'body' => '{
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'GrantToken' => '',
'KeyId' => '',
'GrantId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'GrantToken' => '',
'KeyId' => '',
'GrantId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant"
payload = {
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant"
payload <- "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"GrantToken\": \"\",\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant";
let payload = json!({
"GrantToken": "",
"KeyId": "",
"GrantId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}'
echo '{
"GrantToken": "",
"KeyId": "",
"GrantId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "GrantToken": "",\n "KeyId": "",\n "GrantId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"GrantToken": "",
"KeyId": "",
"GrantId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.RetireGrant")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
RevokeGrant
{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"GrantId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:GrantId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 34
{
"KeyId": "",
"GrantId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
GrantId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', GrantId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GrantId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "GrantId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', GrantId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', GrantId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
GrantId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', GrantId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","GrantId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"GrantId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant",
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([
'KeyId' => '',
'GrantId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant', [
'body' => '{
"KeyId": "",
"GrantId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'GrantId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'GrantId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GrantId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"GrantId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant"
payload = {
"KeyId": "",
"GrantId": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant"
payload <- "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"GrantId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant";
let payload = json!({
"KeyId": "",
"GrantId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"GrantId": ""
}'
echo '{
"KeyId": "",
"GrantId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "GrantId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"GrantId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.RevokeGrant")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ScheduleKeyDeletion
{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"PendingWindowInDays": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:PendingWindowInDays ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 46
{
"KeyId": "",
"PendingWindowInDays": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
PendingWindowInDays: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PendingWindowInDays: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PendingWindowInDays":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "PendingWindowInDays": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', PendingWindowInDays: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', PendingWindowInDays: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
PendingWindowInDays: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PendingWindowInDays: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PendingWindowInDays":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"PendingWindowInDays": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion",
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([
'KeyId' => '',
'PendingWindowInDays' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion', [
'body' => '{
"KeyId": "",
"PendingWindowInDays": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'PendingWindowInDays' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'PendingWindowInDays' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PendingWindowInDays": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PendingWindowInDays": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion"
payload = {
"KeyId": "",
"PendingWindowInDays": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion"
payload <- "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"PendingWindowInDays\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion";
let payload = json!({
"KeyId": "",
"PendingWindowInDays": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"PendingWindowInDays": ""
}'
echo '{
"KeyId": "",
"PendingWindowInDays": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "PendingWindowInDays": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"PendingWindowInDays": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.ScheduleKeyDeletion")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"DeletionDate": "2016-12-17T16:00:00-08:00",
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}
POST
Sign
{{baseUrl}}/#X-Amz-Target=TrentService.Sign
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.Sign");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.Sign" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Message ""
:MessageType ""
:GrantTokens ""
:SigningAlgorithm ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Sign"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.Sign"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.Sign");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.Sign"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 102
{
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.Sign")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.Sign"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Sign")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.Sign")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Message: '',
MessageType: '',
GrantTokens: '',
SigningAlgorithm: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Sign');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Sign',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Message: '', MessageType: '', GrantTokens: '', SigningAlgorithm: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Sign';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Message":"","MessageType":"","GrantTokens":"","SigningAlgorithm":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Sign',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Message": "",\n "MessageType": "",\n "GrantTokens": "",\n "SigningAlgorithm": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Sign")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', Message: '', MessageType: '', GrantTokens: '', SigningAlgorithm: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Sign',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', Message: '', MessageType: '', GrantTokens: '', SigningAlgorithm: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Sign');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Message: '',
MessageType: '',
GrantTokens: '',
SigningAlgorithm: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Sign',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Message: '', MessageType: '', GrantTokens: '', SigningAlgorithm: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Sign';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Message":"","MessageType":"","GrantTokens":"","SigningAlgorithm":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Message": @"",
@"MessageType": @"",
@"GrantTokens": @"",
@"SigningAlgorithm": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.Sign"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.Sign" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.Sign",
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([
'KeyId' => '',
'Message' => '',
'MessageType' => '',
'GrantTokens' => '',
'SigningAlgorithm' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Sign', [
'body' => '{
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Sign');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Message' => '',
'MessageType' => '',
'GrantTokens' => '',
'SigningAlgorithm' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Message' => '',
'MessageType' => '',
'GrantTokens' => '',
'SigningAlgorithm' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Sign');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Sign' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Sign' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Sign"
payload = {
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.Sign"
payload <- "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.Sign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"GrantTokens\": \"\",\n \"SigningAlgorithm\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.Sign";
let payload = json!({
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.Sign' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}'
echo '{
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.Sign' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Message": "",\n "MessageType": "",\n "GrantTokens": "",\n "SigningAlgorithm": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.Sign'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Message": "",
"MessageType": "",
"GrantTokens": "",
"SigningAlgorithm": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.Sign")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321",
"Signature": "",
"SigningAlgorithm": "RSASSA_PKCS1_V1_5_SHA_256"
}
POST
TagResource
{{baseUrl}}/#X-Amz-Target=TrentService.TagResource
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Tags": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Tags ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.TagResource"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.TagResource");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 31
{
"KeyId": "",
"Tags": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.TagResource"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.TagResource")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.TagResource")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Tags: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Tags: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Tags":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Tags": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.TagResource")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', Tags: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', Tags: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Tags: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Tags: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Tags":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Tags": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.TagResource"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.TagResource",
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([
'KeyId' => '',
'Tags' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource', [
'body' => '{
"KeyId": "",
"Tags": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.TagResource');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Tags' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Tags' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.TagResource');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Tags": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Tags": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource"
payload = {
"KeyId": "",
"Tags": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource"
payload <- "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.TagResource")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Tags\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource";
let payload = json!({
"KeyId": "",
"Tags": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Tags": ""
}'
echo '{
"KeyId": "",
"Tags": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Tags": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.TagResource'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Tags": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.TagResource")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
UntagResource
{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"TagKeys": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:TagKeys ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 34
{
"KeyId": "",
"TagKeys": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
TagKeys: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', TagKeys: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","TagKeys":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "TagKeys": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', TagKeys: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', TagKeys: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
TagKeys: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', TagKeys: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","TagKeys":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"TagKeys": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource",
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([
'KeyId' => '',
'TagKeys' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource', [
'body' => '{
"KeyId": "",
"TagKeys": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'TagKeys' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'TagKeys' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"TagKeys": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"TagKeys": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource"
payload = {
"KeyId": "",
"TagKeys": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource"
payload <- "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"TagKeys\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource";
let payload = json!({
"KeyId": "",
"TagKeys": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"TagKeys": ""
}'
echo '{
"KeyId": "",
"TagKeys": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "TagKeys": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"TagKeys": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.UntagResource")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
UpdateAlias
{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias
HEADERS
X-Amz-Target
BODY json
{
"AliasName": "",
"TargetKeyId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:AliasName ""
:TargetKeyId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias"
payload := strings.NewReader("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 42
{
"AliasName": "",
"TargetKeyId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
.asString();
const data = JSON.stringify({
AliasName: '',
TargetKeyId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {AliasName: '', TargetKeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"AliasName":"","TargetKeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "AliasName": "",\n "TargetKeyId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({AliasName: '', TargetKeyId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {AliasName: '', TargetKeyId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
AliasName: '',
TargetKeyId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {AliasName: '', TargetKeyId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"AliasName":"","TargetKeyId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"AliasName": @"",
@"TargetKeyId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias",
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([
'AliasName' => '',
'TargetKeyId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias', [
'body' => '{
"AliasName": "",
"TargetKeyId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'AliasName' => '',
'TargetKeyId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'AliasName' => '',
'TargetKeyId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AliasName": "",
"TargetKeyId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AliasName": "",
"TargetKeyId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias"
payload = {
"AliasName": "",
"TargetKeyId": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias"
payload <- "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"AliasName\": \"\",\n \"TargetKeyId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias";
let payload = json!({
"AliasName": "",
"TargetKeyId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"AliasName": "",
"TargetKeyId": ""
}'
echo '{
"AliasName": "",
"TargetKeyId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "AliasName": "",\n "TargetKeyId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"AliasName": "",
"TargetKeyId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateAlias")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
UpdateCustomKeyStore
{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore
HEADERS
X-Amz-Target
BODY json
{
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:CustomKeyStoreId ""
:NewCustomKeyStoreName ""
:KeyStorePassword ""
:CloudHsmClusterId ""
:XksProxyUriEndpoint ""
:XksProxyUriPath ""
:XksProxyVpcEndpointServiceName ""
:XksProxyAuthenticationCredential ""
:XksProxyConnectivity ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore"
payload := strings.NewReader("{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 278
{
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
.asString();
const data = JSON.stringify({
CustomKeyStoreId: '',
NewCustomKeyStoreName: '',
KeyStorePassword: '',
CloudHsmClusterId: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CustomKeyStoreId: '',
NewCustomKeyStoreName: '',
KeyStorePassword: '',
CloudHsmClusterId: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":"","NewCustomKeyStoreName":"","KeyStorePassword":"","CloudHsmClusterId":"","XksProxyUriEndpoint":"","XksProxyUriPath":"","XksProxyVpcEndpointServiceName":"","XksProxyAuthenticationCredential":"","XksProxyConnectivity":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "CustomKeyStoreId": "",\n "NewCustomKeyStoreName": "",\n "KeyStorePassword": "",\n "CloudHsmClusterId": "",\n "XksProxyUriEndpoint": "",\n "XksProxyUriPath": "",\n "XksProxyVpcEndpointServiceName": "",\n "XksProxyAuthenticationCredential": "",\n "XksProxyConnectivity": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
CustomKeyStoreId: '',
NewCustomKeyStoreName: '',
KeyStorePassword: '',
CloudHsmClusterId: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
CustomKeyStoreId: '',
NewCustomKeyStoreName: '',
KeyStorePassword: '',
CloudHsmClusterId: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
CustomKeyStoreId: '',
NewCustomKeyStoreName: '',
KeyStorePassword: '',
CloudHsmClusterId: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
CustomKeyStoreId: '',
NewCustomKeyStoreName: '',
KeyStorePassword: '',
CloudHsmClusterId: '',
XksProxyUriEndpoint: '',
XksProxyUriPath: '',
XksProxyVpcEndpointServiceName: '',
XksProxyAuthenticationCredential: '',
XksProxyConnectivity: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"CustomKeyStoreId":"","NewCustomKeyStoreName":"","KeyStorePassword":"","CloudHsmClusterId":"","XksProxyUriEndpoint":"","XksProxyUriPath":"","XksProxyVpcEndpointServiceName":"","XksProxyAuthenticationCredential":"","XksProxyConnectivity":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"CustomKeyStoreId": @"",
@"NewCustomKeyStoreName": @"",
@"KeyStorePassword": @"",
@"CloudHsmClusterId": @"",
@"XksProxyUriEndpoint": @"",
@"XksProxyUriPath": @"",
@"XksProxyVpcEndpointServiceName": @"",
@"XksProxyAuthenticationCredential": @"",
@"XksProxyConnectivity": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore",
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([
'CustomKeyStoreId' => '',
'NewCustomKeyStoreName' => '',
'KeyStorePassword' => '',
'CloudHsmClusterId' => '',
'XksProxyUriEndpoint' => '',
'XksProxyUriPath' => '',
'XksProxyVpcEndpointServiceName' => '',
'XksProxyAuthenticationCredential' => '',
'XksProxyConnectivity' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore', [
'body' => '{
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CustomKeyStoreId' => '',
'NewCustomKeyStoreName' => '',
'KeyStorePassword' => '',
'CloudHsmClusterId' => '',
'XksProxyUriEndpoint' => '',
'XksProxyUriPath' => '',
'XksProxyVpcEndpointServiceName' => '',
'XksProxyAuthenticationCredential' => '',
'XksProxyConnectivity' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CustomKeyStoreId' => '',
'NewCustomKeyStoreName' => '',
'KeyStorePassword' => '',
'CloudHsmClusterId' => '',
'XksProxyUriEndpoint' => '',
'XksProxyUriPath' => '',
'XksProxyVpcEndpointServiceName' => '',
'XksProxyAuthenticationCredential' => '',
'XksProxyConnectivity' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore"
payload = {
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore"
payload <- "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"CustomKeyStoreId\": \"\",\n \"NewCustomKeyStoreName\": \"\",\n \"KeyStorePassword\": \"\",\n \"CloudHsmClusterId\": \"\",\n \"XksProxyUriEndpoint\": \"\",\n \"XksProxyUriPath\": \"\",\n \"XksProxyVpcEndpointServiceName\": \"\",\n \"XksProxyAuthenticationCredential\": \"\",\n \"XksProxyConnectivity\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore";
let payload = json!({
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}'
echo '{
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "CustomKeyStoreId": "",\n "NewCustomKeyStoreName": "",\n "KeyStorePassword": "",\n "CloudHsmClusterId": "",\n "XksProxyUriEndpoint": "",\n "XksProxyUriPath": "",\n "XksProxyVpcEndpointServiceName": "",\n "XksProxyAuthenticationCredential": "",\n "XksProxyConnectivity": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"CustomKeyStoreId": "",
"NewCustomKeyStoreName": "",
"KeyStorePassword": "",
"CloudHsmClusterId": "",
"XksProxyUriEndpoint": "",
"XksProxyUriPath": "",
"XksProxyVpcEndpointServiceName": "",
"XksProxyAuthenticationCredential": "",
"XksProxyConnectivity": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateCustomKeyStore")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
UpdateKeyDescription
{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Description": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Description ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 38
{
"KeyId": "",
"Description": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Description: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Description: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Description":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Description": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', Description: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', Description: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Description: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', Description: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Description":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Description": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription",
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([
'KeyId' => '',
'Description' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription', [
'body' => '{
"KeyId": "",
"Description": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Description' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Description' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Description": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Description": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription"
payload = {
"KeyId": "",
"Description": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription"
payload <- "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Description\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription";
let payload = json!({
"KeyId": "",
"Description": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Description": ""
}'
echo '{
"KeyId": "",
"Description": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Description": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Description": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.UpdateKeyDescription")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
UpdatePrimaryRegion
{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"PrimaryRegion": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:PrimaryRegion ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 40
{
"KeyId": "",
"PrimaryRegion": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
PrimaryRegion: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PrimaryRegion: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PrimaryRegion":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "PrimaryRegion": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({KeyId: '', PrimaryRegion: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {KeyId: '', PrimaryRegion: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
PrimaryRegion: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {KeyId: '', PrimaryRegion: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","PrimaryRegion":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"PrimaryRegion": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion",
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([
'KeyId' => '',
'PrimaryRegion' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion', [
'body' => '{
"KeyId": "",
"PrimaryRegion": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'PrimaryRegion' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'PrimaryRegion' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PrimaryRegion": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"PrimaryRegion": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion"
payload = {
"KeyId": "",
"PrimaryRegion": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion"
payload <- "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"PrimaryRegion\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion";
let payload = json!({
"KeyId": "",
"PrimaryRegion": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"PrimaryRegion": ""
}'
echo '{
"KeyId": "",
"PrimaryRegion": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "PrimaryRegion": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"PrimaryRegion": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.UpdatePrimaryRegion")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Verify
{{baseUrl}}/#X-Amz-Target=TrentService.Verify
HEADERS
X-Amz-Target
BODY json
{
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.Verify");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.Verify" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:KeyId ""
:Message ""
:MessageType ""
:Signature ""
:SigningAlgorithm ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Verify"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.Verify"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.Verify");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.Verify"
payload := strings.NewReader("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 121
{
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.Verify")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.Verify"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Verify")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.Verify")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
KeyId: '',
Message: '',
MessageType: '',
Signature: '',
SigningAlgorithm: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Verify');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Verify',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
Message: '',
MessageType: '',
Signature: '',
SigningAlgorithm: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Verify';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Message":"","MessageType":"","Signature":"","SigningAlgorithm":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Verify',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "KeyId": "",\n "Message": "",\n "MessageType": "",\n "Signature": "",\n "SigningAlgorithm": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.Verify")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
KeyId: '',
Message: '',
MessageType: '',
Signature: '',
SigningAlgorithm: '',
GrantTokens: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Verify',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
KeyId: '',
Message: '',
MessageType: '',
Signature: '',
SigningAlgorithm: '',
GrantTokens: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Verify');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
KeyId: '',
Message: '',
MessageType: '',
Signature: '',
SigningAlgorithm: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.Verify',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
KeyId: '',
Message: '',
MessageType: '',
Signature: '',
SigningAlgorithm: '',
GrantTokens: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.Verify';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"KeyId":"","Message":"","MessageType":"","Signature":"","SigningAlgorithm":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"KeyId": @"",
@"Message": @"",
@"MessageType": @"",
@"Signature": @"",
@"SigningAlgorithm": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.Verify"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.Verify" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.Verify",
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([
'KeyId' => '',
'Message' => '',
'MessageType' => '',
'Signature' => '',
'SigningAlgorithm' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.Verify', [
'body' => '{
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Verify');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'KeyId' => '',
'Message' => '',
'MessageType' => '',
'Signature' => '',
'SigningAlgorithm' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'KeyId' => '',
'Message' => '',
'MessageType' => '',
'Signature' => '',
'SigningAlgorithm' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.Verify');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Verify' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.Verify' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.Verify"
payload = {
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.Verify"
payload <- "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.Verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"KeyId\": \"\",\n \"Message\": \"\",\n \"MessageType\": \"\",\n \"Signature\": \"\",\n \"SigningAlgorithm\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.Verify";
let payload = json!({
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.Verify' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}'
echo '{
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.Verify' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "KeyId": "",\n "Message": "",\n "MessageType": "",\n "Signature": "",\n "SigningAlgorithm": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.Verify'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"KeyId": "",
"Message": "",
"MessageType": "",
"Signature": "",
"SigningAlgorithm": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.Verify")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-east-2:111122223333:key/0987dcba-09fe-87dc-65ba-ab0987654321",
"SignatureValid": true,
"SigningAlgorithm": "RSASSA_PSS_SHA_512"
}
POST
VerifyMac
{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac
HEADERS
X-Amz-Target
BODY json
{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-amz-target: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:Message ""
:KeyId ""
:MacAlgorithm ""
:Mac ""
:GrantTokens ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac"
payload := strings.NewReader("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-amz-target", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ HTTP/1.1
X-Amz-Target:
Content-Type: application/json
Host: example.com
Content-Length: 90
{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}")
.asString();
const data = JSON.stringify({
Message: '',
KeyId: '',
MacAlgorithm: '',
Mac: '',
GrantTokens: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac');
xhr.setRequestHeader('x-amz-target', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Message: '', KeyId: '', MacAlgorithm: '', Mac: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Message":"","KeyId":"","MacAlgorithm":"","Mac":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Message": "",\n "KeyId": "",\n "MacAlgorithm": "",\n "Mac": "",\n "GrantTokens": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac")
.post(body)
.addHeader("x-amz-target", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({Message: '', KeyId: '', MacAlgorithm: '', Mac: '', GrantTokens: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {Message: '', KeyId: '', MacAlgorithm: '', Mac: '', GrantTokens: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Message: '',
KeyId: '',
MacAlgorithm: '',
Mac: '',
GrantTokens: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {Message: '', KeyId: '', MacAlgorithm: '', Mac: '', GrantTokens: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Message":"","KeyId":"","MacAlgorithm":"","Mac":"","GrantTokens":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-amz-target": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Message": @"",
@"KeyId": @"",
@"MacAlgorithm": @"",
@"Mac": @"",
@"GrantTokens": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac",
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([
'Message' => '',
'KeyId' => '',
'MacAlgorithm' => '',
'Mac' => '',
'GrantTokens' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-amz-target: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac', [
'body' => '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Message' => '',
'KeyId' => '',
'MacAlgorithm' => '',
'Mac' => '',
'GrantTokens' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Message' => '',
'KeyId' => '',
'MacAlgorithm' => '',
'Mac' => '',
'GrantTokens' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}"
headers = {
'x-amz-target': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac"
payload = {
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}
headers = {
"x-amz-target": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac"
payload <- "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-amz-target' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-amz-target"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/') do |req|
req.headers['x-amz-target'] = ''
req.body = "{\n \"Message\": \"\",\n \"KeyId\": \"\",\n \"MacAlgorithm\": \"\",\n \"Mac\": \"\",\n \"GrantTokens\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac";
let payload = json!({
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-amz-target", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}'
echo '{
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "Message": "",\n "KeyId": "",\n "MacAlgorithm": "",\n "Mac": "",\n "GrantTokens": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"Message": "",
"KeyId": "",
"MacAlgorithm": "",
"Mac": "",
"GrantTokens": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=TrentService.VerifyMac")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
"MacAlgorithm": "HMAC_SHA_384",
"MacValid": true
}