AWS Secrets Manager
AWS Secrets Managerv2017-10-17
Amazon Web Services Secrets Manager Amazon Web Services Secrets Manager provides a service to enable you to store, manage, and retrieve, secrets. This guide provides descriptions of the Secrets Manager API. For more information about using this service, see the Amazon Web Services Secrets Manager User Guide . API Version This version of the Secrets Manager API Reference documents the Secrets Manager API version 2017-10-17. For a list of endpoints, see Amazon Web Services Secrets Manager endpoints . Support and Feedback for Amazon Web Services Secrets Manager We welcome your feedback. Send…
- Endpoints
- 22 (22 POST)
- Base URL
http://secretsmanager.{region}.amazonaws.com- Authentication
- API key
- Spec format
- OpenAPI 3.0.0
- API version
- 2017-10-17
- Provider
- amazonaws.com
- License
- Apache 2.0 License
- Categories
- Cloud & Infrastructure
- Last updated
Use this API in Bruno:
- Download the Bruno collection above and unzip it.
- In Bruno, choose Open Collection and select the unzipped folder.
- Set the
baseUrlvariable (for examplehttp://secretsmanager.{region}.amazonaws.com) and your API key credentials, then send requests.
POST
CancelRotateSecret
{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret
HEADERS
X-Amz-Target
BODY json
{
"SecretId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret");
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 \"SecretId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\"\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=secretsmanager.CancelRotateSecret"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\"\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=secretsmanager.CancelRotateSecret");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret"
payload := strings.NewReader("{\n \"SecretId\": \"\"\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: 20
{
"SecretId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\"\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 \"SecretId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret")
.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=secretsmanager.CancelRotateSecret")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: ''
});
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=secretsmanager.CancelRotateSecret');
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=secretsmanager.CancelRotateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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=secretsmanager.CancelRotateSecret',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret")
.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({SecretId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: ''},
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=secretsmanager.CancelRotateSecret');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: ''
});
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=secretsmanager.CancelRotateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
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=secretsmanager.CancelRotateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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 = @{ @"SecretId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret"]
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=secretsmanager.CancelRotateSecret" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret",
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([
'SecretId' => ''
]),
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=secretsmanager.CancelRotateSecret', [
'body' => '{
"SecretId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret');
$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=secretsmanager.CancelRotateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\"\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=secretsmanager.CancelRotateSecret"
payload = { "SecretId": "" }
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=secretsmanager.CancelRotateSecret"
payload <- "{\n \"SecretId\": \"\"\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=secretsmanager.CancelRotateSecret")
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 \"SecretId\": \"\"\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 \"SecretId\": \"\"\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=secretsmanager.CancelRotateSecret";
let payload = json!({"SecretId": ""});
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=secretsmanager.CancelRotateSecret' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": ""
}'
echo '{
"SecretId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["SecretId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.CancelRotateSecret")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "Name"
}
POST
CreateSecret
{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret
HEADERS
X-Amz-Target
BODY json
{
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret");
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 \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:Name ""
:ClientRequestToken ""
:Description ""
:KmsKeyId ""
:SecretBinary ""
:SecretString ""
:Tags ""
:AddReplicaRegions ""
:ForceOverwriteReplicaSecret ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.CreateSecret"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.CreateSecret");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret"
payload := strings.NewReader("{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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: 205
{
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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 \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret")
.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=secretsmanager.CreateSecret")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}")
.asString();
const data = JSON.stringify({
Name: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: '',
Tags: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
});
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=secretsmanager.CreateSecret');
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=secretsmanager.CreateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
Name: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: '',
Tags: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Name":"","ClientRequestToken":"","Description":"","KmsKeyId":"","SecretBinary":"","SecretString":"","Tags":"","AddReplicaRegions":"","ForceOverwriteReplicaSecret":""}'
};
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=secretsmanager.CreateSecret',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Name": "",\n "ClientRequestToken": "",\n "Description": "",\n "KmsKeyId": "",\n "SecretBinary": "",\n "SecretString": "",\n "Tags": "",\n "AddReplicaRegions": "",\n "ForceOverwriteReplicaSecret": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret")
.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({
Name: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: '',
Tags: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
Name: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: '',
Tags: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
},
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=secretsmanager.CreateSecret');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Name: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: '',
Tags: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
});
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=secretsmanager.CreateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
Name: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: '',
Tags: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
}
};
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=secretsmanager.CreateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"Name":"","ClientRequestToken":"","Description":"","KmsKeyId":"","SecretBinary":"","SecretString":"","Tags":"","AddReplicaRegions":"","ForceOverwriteReplicaSecret":""}'
};
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 = @{ @"Name": @"",
@"ClientRequestToken": @"",
@"Description": @"",
@"KmsKeyId": @"",
@"SecretBinary": @"",
@"SecretString": @"",
@"Tags": @"",
@"AddReplicaRegions": @"",
@"ForceOverwriteReplicaSecret": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret"]
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=secretsmanager.CreateSecret" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret",
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([
'Name' => '',
'ClientRequestToken' => '',
'Description' => '',
'KmsKeyId' => '',
'SecretBinary' => '',
'SecretString' => '',
'Tags' => '',
'AddReplicaRegions' => '',
'ForceOverwriteReplicaSecret' => ''
]),
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=secretsmanager.CreateSecret', [
'body' => '{
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Name' => '',
'ClientRequestToken' => '',
'Description' => '',
'KmsKeyId' => '',
'SecretBinary' => '',
'SecretString' => '',
'Tags' => '',
'AddReplicaRegions' => '',
'ForceOverwriteReplicaSecret' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Name' => '',
'ClientRequestToken' => '',
'Description' => '',
'KmsKeyId' => '',
'SecretBinary' => '',
'SecretString' => '',
'Tags' => '',
'AddReplicaRegions' => '',
'ForceOverwriteReplicaSecret' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret');
$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=secretsmanager.CreateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.CreateSecret"
payload = {
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}
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=secretsmanager.CreateSecret"
payload <- "{\n \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.CreateSecret")
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 \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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 \"Name\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"Tags\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.CreateSecret";
let payload = json!({
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
});
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=secretsmanager.CreateSecret' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}'
echo '{
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "Name": "",\n "ClientRequestToken": "",\n "Description": "",\n "KmsKeyId": "",\n "SecretBinary": "",\n "SecretString": "",\n "Tags": "",\n "AddReplicaRegions": "",\n "ForceOverwriteReplicaSecret": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"Name": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": "",
"Tags": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.CreateSecret")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret",
"VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
}
POST
DeleteResourcePolicy
{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy
HEADERS
X-Amz-Target
BODY json
{
"SecretId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy");
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 \"SecretId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\"\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=secretsmanager.DeleteResourcePolicy"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\"\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=secretsmanager.DeleteResourcePolicy");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy"
payload := strings.NewReader("{\n \"SecretId\": \"\"\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: 20
{
"SecretId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\"\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 \"SecretId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy")
.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=secretsmanager.DeleteResourcePolicy")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: ''
});
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=secretsmanager.DeleteResourcePolicy');
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=secretsmanager.DeleteResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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=secretsmanager.DeleteResourcePolicy',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy")
.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({SecretId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: ''},
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=secretsmanager.DeleteResourcePolicy');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: ''
});
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=secretsmanager.DeleteResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
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=secretsmanager.DeleteResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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 = @{ @"SecretId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy"]
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=secretsmanager.DeleteResourcePolicy" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy",
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([
'SecretId' => ''
]),
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=secretsmanager.DeleteResourcePolicy', [
'body' => '{
"SecretId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy');
$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=secretsmanager.DeleteResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\"\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=secretsmanager.DeleteResourcePolicy"
payload = { "SecretId": "" }
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=secretsmanager.DeleteResourcePolicy"
payload <- "{\n \"SecretId\": \"\"\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=secretsmanager.DeleteResourcePolicy")
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 \"SecretId\": \"\"\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 \"SecretId\": \"\"\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=secretsmanager.DeleteResourcePolicy";
let payload = json!({"SecretId": ""});
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=secretsmanager.DeleteResourcePolicy' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": ""
}'
echo '{
"SecretId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["SecretId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteResourcePolicy")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseMasterSecret-a1b2c3",
"Name": "MyTestDatabaseSecret"
}
POST
DeleteSecret
{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret");
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 \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:RecoveryWindowInDays ""
:ForceDeleteWithoutRecovery ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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=secretsmanager.DeleteSecret"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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=secretsmanager.DeleteSecret");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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
{
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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 \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret")
.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=secretsmanager.DeleteSecret")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
RecoveryWindowInDays: '',
ForceDeleteWithoutRecovery: ''
});
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=secretsmanager.DeleteSecret');
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=secretsmanager.DeleteSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', RecoveryWindowInDays: '', ForceDeleteWithoutRecovery: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","RecoveryWindowInDays":"","ForceDeleteWithoutRecovery":""}'
};
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=secretsmanager.DeleteSecret',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "RecoveryWindowInDays": "",\n "ForceDeleteWithoutRecovery": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret")
.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({SecretId: '', RecoveryWindowInDays: '', ForceDeleteWithoutRecovery: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', RecoveryWindowInDays: '', ForceDeleteWithoutRecovery: ''},
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=secretsmanager.DeleteSecret');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
RecoveryWindowInDays: '',
ForceDeleteWithoutRecovery: ''
});
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=secretsmanager.DeleteSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', RecoveryWindowInDays: '', ForceDeleteWithoutRecovery: ''}
};
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=secretsmanager.DeleteSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","RecoveryWindowInDays":"","ForceDeleteWithoutRecovery":""}'
};
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 = @{ @"SecretId": @"",
@"RecoveryWindowInDays": @"",
@"ForceDeleteWithoutRecovery": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret"]
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=secretsmanager.DeleteSecret" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret",
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([
'SecretId' => '',
'RecoveryWindowInDays' => '',
'ForceDeleteWithoutRecovery' => ''
]),
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=secretsmanager.DeleteSecret', [
'body' => '{
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'RecoveryWindowInDays' => '',
'ForceDeleteWithoutRecovery' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'RecoveryWindowInDays' => '',
'ForceDeleteWithoutRecovery' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret');
$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=secretsmanager.DeleteSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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=secretsmanager.DeleteSecret"
payload = {
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}
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=secretsmanager.DeleteSecret"
payload <- "{\n \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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=secretsmanager.DeleteSecret")
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 \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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 \"SecretId\": \"\",\n \"RecoveryWindowInDays\": \"\",\n \"ForceDeleteWithoutRecovery\": \"\"\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=secretsmanager.DeleteSecret";
let payload = json!({
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
});
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=secretsmanager.DeleteSecret' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}'
echo '{
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "RecoveryWindowInDays": "",\n "ForceDeleteWithoutRecovery": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"RecoveryWindowInDays": "",
"ForceDeleteWithoutRecovery": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.DeleteSecret")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"DeletionDate": "1524085349.095",
"Name": "MyTestDatabaseSecret"
}
POST
DescribeSecret
{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret
HEADERS
X-Amz-Target
BODY json
{
"SecretId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret");
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 \"SecretId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\"\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=secretsmanager.DescribeSecret"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\"\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=secretsmanager.DescribeSecret");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret"
payload := strings.NewReader("{\n \"SecretId\": \"\"\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: 20
{
"SecretId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\"\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 \"SecretId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret")
.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=secretsmanager.DescribeSecret")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: ''
});
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=secretsmanager.DescribeSecret');
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=secretsmanager.DescribeSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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=secretsmanager.DescribeSecret',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret")
.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({SecretId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: ''},
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=secretsmanager.DescribeSecret');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: ''
});
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=secretsmanager.DescribeSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
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=secretsmanager.DescribeSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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 = @{ @"SecretId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret"]
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=secretsmanager.DescribeSecret" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret",
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([
'SecretId' => ''
]),
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=secretsmanager.DescribeSecret', [
'body' => '{
"SecretId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret');
$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=secretsmanager.DescribeSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\"\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=secretsmanager.DescribeSecret"
payload = { "SecretId": "" }
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=secretsmanager.DescribeSecret"
payload <- "{\n \"SecretId\": \"\"\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=secretsmanager.DescribeSecret")
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 \"SecretId\": \"\"\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 \"SecretId\": \"\"\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=secretsmanager.DescribeSecret";
let payload = json!({"SecretId": ""});
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=secretsmanager.DescribeSecret' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": ""
}'
echo '{
"SecretId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["SecretId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.DescribeSecret")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Description": "My test database secret",
"KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/EXAMPLE1-90ab-cdef-fedc-ba987KMSKEY1",
"LastAccessedDate": "1523923200",
"LastChangedDate": 1523477145.729,
"LastRotatedDate": 1525747253.72,
"Name": "MyTestDatabaseSecret",
"NextRotationDate": "1665165599",
"RotationEnabled": true,
"RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestRotationLambda",
"RotationRules": {
"AutomaticallyAfterDays": 14,
"Duration": "2h",
"ScheduleExpression": "cron(0 16 1,15 * ? *)"
},
"Tags": [
{
"Key": "SecondTag",
"Value": "AnotherValue"
},
{
"Key": "FirstTag",
"Value": "SomeValue"
}
],
"VersionIdsToStages": {
"EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE": [
"AWSPREVIOUS"
],
"EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE": [
"AWSCURRENT"
]
}
}
POST
GetRandomPassword
{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword
HEADERS
X-Amz-Target
BODY json
{
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword");
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 \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:PasswordLength ""
:ExcludeCharacters ""
:ExcludeNumbers ""
:ExcludePunctuation ""
:ExcludeUppercase ""
:ExcludeLowercase ""
:IncludeSpace ""
:RequireEachIncludedType ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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=secretsmanager.GetRandomPassword"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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=secretsmanager.GetRandomPassword");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword"
payload := strings.NewReader("{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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: 212
{
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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 \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword")
.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=secretsmanager.GetRandomPassword")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\n}")
.asString();
const data = JSON.stringify({
PasswordLength: '',
ExcludeCharacters: '',
ExcludeNumbers: '',
ExcludePunctuation: '',
ExcludeUppercase: '',
ExcludeLowercase: '',
IncludeSpace: '',
RequireEachIncludedType: ''
});
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=secretsmanager.GetRandomPassword');
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=secretsmanager.GetRandomPassword',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
PasswordLength: '',
ExcludeCharacters: '',
ExcludeNumbers: '',
ExcludePunctuation: '',
ExcludeUppercase: '',
ExcludeLowercase: '',
IncludeSpace: '',
RequireEachIncludedType: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"PasswordLength":"","ExcludeCharacters":"","ExcludeNumbers":"","ExcludePunctuation":"","ExcludeUppercase":"","ExcludeLowercase":"","IncludeSpace":"","RequireEachIncludedType":""}'
};
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=secretsmanager.GetRandomPassword',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "PasswordLength": "",\n "ExcludeCharacters": "",\n "ExcludeNumbers": "",\n "ExcludePunctuation": "",\n "ExcludeUppercase": "",\n "ExcludeLowercase": "",\n "IncludeSpace": "",\n "RequireEachIncludedType": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword")
.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({
PasswordLength: '',
ExcludeCharacters: '',
ExcludeNumbers: '',
ExcludePunctuation: '',
ExcludeUppercase: '',
ExcludeLowercase: '',
IncludeSpace: '',
RequireEachIncludedType: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
PasswordLength: '',
ExcludeCharacters: '',
ExcludeNumbers: '',
ExcludePunctuation: '',
ExcludeUppercase: '',
ExcludeLowercase: '',
IncludeSpace: '',
RequireEachIncludedType: ''
},
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=secretsmanager.GetRandomPassword');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
PasswordLength: '',
ExcludeCharacters: '',
ExcludeNumbers: '',
ExcludePunctuation: '',
ExcludeUppercase: '',
ExcludeLowercase: '',
IncludeSpace: '',
RequireEachIncludedType: ''
});
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=secretsmanager.GetRandomPassword',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
PasswordLength: '',
ExcludeCharacters: '',
ExcludeNumbers: '',
ExcludePunctuation: '',
ExcludeUppercase: '',
ExcludeLowercase: '',
IncludeSpace: '',
RequireEachIncludedType: ''
}
};
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=secretsmanager.GetRandomPassword';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"PasswordLength":"","ExcludeCharacters":"","ExcludeNumbers":"","ExcludePunctuation":"","ExcludeUppercase":"","ExcludeLowercase":"","IncludeSpace":"","RequireEachIncludedType":""}'
};
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 = @{ @"PasswordLength": @"",
@"ExcludeCharacters": @"",
@"ExcludeNumbers": @"",
@"ExcludePunctuation": @"",
@"ExcludeUppercase": @"",
@"ExcludeLowercase": @"",
@"IncludeSpace": @"",
@"RequireEachIncludedType": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword"]
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=secretsmanager.GetRandomPassword" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword",
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([
'PasswordLength' => '',
'ExcludeCharacters' => '',
'ExcludeNumbers' => '',
'ExcludePunctuation' => '',
'ExcludeUppercase' => '',
'ExcludeLowercase' => '',
'IncludeSpace' => '',
'RequireEachIncludedType' => ''
]),
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=secretsmanager.GetRandomPassword', [
'body' => '{
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'PasswordLength' => '',
'ExcludeCharacters' => '',
'ExcludeNumbers' => '',
'ExcludePunctuation' => '',
'ExcludeUppercase' => '',
'ExcludeLowercase' => '',
'IncludeSpace' => '',
'RequireEachIncludedType' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'PasswordLength' => '',
'ExcludeCharacters' => '',
'ExcludeNumbers' => '',
'ExcludePunctuation' => '',
'ExcludeUppercase' => '',
'ExcludeLowercase' => '',
'IncludeSpace' => '',
'RequireEachIncludedType' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword');
$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=secretsmanager.GetRandomPassword' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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=secretsmanager.GetRandomPassword"
payload = {
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}
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=secretsmanager.GetRandomPassword"
payload <- "{\n \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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=secretsmanager.GetRandomPassword")
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 \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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 \"PasswordLength\": \"\",\n \"ExcludeCharacters\": \"\",\n \"ExcludeNumbers\": \"\",\n \"ExcludePunctuation\": \"\",\n \"ExcludeUppercase\": \"\",\n \"ExcludeLowercase\": \"\",\n \"IncludeSpace\": \"\",\n \"RequireEachIncludedType\": \"\"\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=secretsmanager.GetRandomPassword";
let payload = json!({
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
});
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=secretsmanager.GetRandomPassword' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}'
echo '{
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "PasswordLength": "",\n "ExcludeCharacters": "",\n "ExcludeNumbers": "",\n "ExcludePunctuation": "",\n "ExcludeUppercase": "",\n "ExcludeLowercase": "",\n "IncludeSpace": "",\n "RequireEachIncludedType": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"PasswordLength": "",
"ExcludeCharacters": "",
"ExcludeNumbers": "",
"ExcludePunctuation": "",
"ExcludeUppercase": "",
"ExcludeLowercase": "",
"IncludeSpace": "",
"RequireEachIncludedType": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetRandomPassword")! 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
{
"RandomPassword": "EXAMPLE-PASSWORD"
}
POST
GetResourcePolicy
{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy
HEADERS
X-Amz-Target
BODY json
{
"SecretId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy");
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 \"SecretId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\"\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=secretsmanager.GetResourcePolicy"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\"\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=secretsmanager.GetResourcePolicy");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy"
payload := strings.NewReader("{\n \"SecretId\": \"\"\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: 20
{
"SecretId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\"\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 \"SecretId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy")
.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=secretsmanager.GetResourcePolicy")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: ''
});
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=secretsmanager.GetResourcePolicy');
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=secretsmanager.GetResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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=secretsmanager.GetResourcePolicy',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy")
.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({SecretId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: ''},
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=secretsmanager.GetResourcePolicy');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: ''
});
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=secretsmanager.GetResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
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=secretsmanager.GetResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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 = @{ @"SecretId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy"]
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=secretsmanager.GetResourcePolicy" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy",
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([
'SecretId' => ''
]),
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=secretsmanager.GetResourcePolicy', [
'body' => '{
"SecretId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy');
$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=secretsmanager.GetResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\"\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=secretsmanager.GetResourcePolicy"
payload = { "SecretId": "" }
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=secretsmanager.GetResourcePolicy"
payload <- "{\n \"SecretId\": \"\"\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=secretsmanager.GetResourcePolicy")
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 \"SecretId\": \"\"\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 \"SecretId\": \"\"\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=secretsmanager.GetResourcePolicy";
let payload = json!({"SecretId": ""});
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=secretsmanager.GetResourcePolicy' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": ""
}'
echo '{
"SecretId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["SecretId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetResourcePolicy")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret",
"ResourcePolicy": "{\n\"Version\":\"2012-10-17\",\n\"Statement\":[{\n\"Effect\":\"Allow\",\n\"Principal\":{\n\"AWS\":\"arn:aws:iam::123456789012:root\"\n},\n\"Action\":\"secretsmanager:GetSecretValue\",\n\"Resource\":\"*\"\n}]\n}"
}
POST
GetSecretValue
{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue");
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 \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:VersionId ""
:VersionStage ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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=secretsmanager.GetSecretValue"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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=secretsmanager.GetSecretValue");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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: 61
{
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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 \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue")
.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=secretsmanager.GetSecretValue")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
VersionId: '',
VersionStage: ''
});
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=secretsmanager.GetSecretValue');
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=secretsmanager.GetSecretValue',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', VersionId: '', VersionStage: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","VersionId":"","VersionStage":""}'
};
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=secretsmanager.GetSecretValue',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "VersionId": "",\n "VersionStage": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue")
.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({SecretId: '', VersionId: '', VersionStage: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', VersionId: '', VersionStage: ''},
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=secretsmanager.GetSecretValue');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
VersionId: '',
VersionStage: ''
});
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=secretsmanager.GetSecretValue',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', VersionId: '', VersionStage: ''}
};
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=secretsmanager.GetSecretValue';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","VersionId":"","VersionStage":""}'
};
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 = @{ @"SecretId": @"",
@"VersionId": @"",
@"VersionStage": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue"]
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=secretsmanager.GetSecretValue" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue",
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([
'SecretId' => '',
'VersionId' => '',
'VersionStage' => ''
]),
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=secretsmanager.GetSecretValue', [
'body' => '{
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'VersionId' => '',
'VersionStage' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'VersionId' => '',
'VersionStage' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue');
$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=secretsmanager.GetSecretValue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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=secretsmanager.GetSecretValue"
payload = {
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}
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=secretsmanager.GetSecretValue"
payload <- "{\n \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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=secretsmanager.GetSecretValue")
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 \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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 \"SecretId\": \"\",\n \"VersionId\": \"\",\n \"VersionStage\": \"\"\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=secretsmanager.GetSecretValue";
let payload = json!({
"SecretId": "",
"VersionId": "",
"VersionStage": ""
});
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=secretsmanager.GetSecretValue' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}'
echo '{
"SecretId": "",
"VersionId": "",
"VersionStage": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "VersionId": "",\n "VersionStage": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"VersionId": "",
"VersionStage": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.GetSecretValue")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"CreatedDate": 1523477145.713,
"Name": "MyTestDatabaseSecret",
"SecretString": "{\n \"username\":\"david\",\n \"password\":\"EXAMPLE-PASSWORD\"\n}\n",
"VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
"VersionStages": [
"AWSPREVIOUS"
]
}
POST
ListSecretVersionIds
{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds");
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 \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:MaxResults ""
:NextToken ""
:IncludeDeprecated ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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=secretsmanager.ListSecretVersionIds"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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=secretsmanager.ListSecretVersionIds");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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
{
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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 \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds")
.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=secretsmanager.ListSecretVersionIds")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
MaxResults: '',
NextToken: '',
IncludeDeprecated: ''
});
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=secretsmanager.ListSecretVersionIds');
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=secretsmanager.ListSecretVersionIds',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', MaxResults: '', NextToken: '', IncludeDeprecated: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","MaxResults":"","NextToken":"","IncludeDeprecated":""}'
};
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=secretsmanager.ListSecretVersionIds',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "MaxResults": "",\n "NextToken": "",\n "IncludeDeprecated": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds")
.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({SecretId: '', MaxResults: '', NextToken: '', IncludeDeprecated: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', MaxResults: '', NextToken: '', IncludeDeprecated: ''},
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=secretsmanager.ListSecretVersionIds');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
MaxResults: '',
NextToken: '',
IncludeDeprecated: ''
});
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=secretsmanager.ListSecretVersionIds',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', MaxResults: '', NextToken: '', IncludeDeprecated: ''}
};
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=secretsmanager.ListSecretVersionIds';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","MaxResults":"","NextToken":"","IncludeDeprecated":""}'
};
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 = @{ @"SecretId": @"",
@"MaxResults": @"",
@"NextToken": @"",
@"IncludeDeprecated": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds"]
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=secretsmanager.ListSecretVersionIds" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds",
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([
'SecretId' => '',
'MaxResults' => '',
'NextToken' => '',
'IncludeDeprecated' => ''
]),
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=secretsmanager.ListSecretVersionIds', [
'body' => '{
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'MaxResults' => '',
'NextToken' => '',
'IncludeDeprecated' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'MaxResults' => '',
'NextToken' => '',
'IncludeDeprecated' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds');
$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=secretsmanager.ListSecretVersionIds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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=secretsmanager.ListSecretVersionIds"
payload = {
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}
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=secretsmanager.ListSecretVersionIds"
payload <- "{\n \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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=secretsmanager.ListSecretVersionIds")
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 \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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 \"SecretId\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"IncludeDeprecated\": \"\"\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=secretsmanager.ListSecretVersionIds";
let payload = json!({
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
});
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=secretsmanager.ListSecretVersionIds' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}'
echo '{
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "MaxResults": "",\n "NextToken": "",\n "IncludeDeprecated": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"MaxResults": "",
"NextToken": "",
"IncludeDeprecated": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecretVersionIds")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret",
"Versions": [
{
"CreatedDate": 1523477145.713,
"VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE",
"VersionStages": [
"AWSPREVIOUS"
]
},
{
"CreatedDate": 1523486221.391,
"VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
"VersionStages": [
"AWSCURRENT"
]
},
{
"CreatedDate": 1511974462.36,
"VersionId": "EXAMPLE3-90ab-cdef-fedc-ba987EXAMPLE;"
}
]
}
POST
ListSecrets
{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets
HEADERS
X-Amz-Target
BODY json
{
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets");
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 \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:IncludePlannedDeletion ""
:MaxResults ""
:NextToken ""
:Filters ""
:SortOrder ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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=secretsmanager.ListSecrets"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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=secretsmanager.ListSecrets");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets"
payload := strings.NewReader("{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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: 109
{
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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 \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets")
.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=secretsmanager.ListSecrets")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\n}")
.asString();
const data = JSON.stringify({
IncludePlannedDeletion: '',
MaxResults: '',
NextToken: '',
Filters: '',
SortOrder: ''
});
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=secretsmanager.ListSecrets');
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=secretsmanager.ListSecrets',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
IncludePlannedDeletion: '',
MaxResults: '',
NextToken: '',
Filters: '',
SortOrder: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"IncludePlannedDeletion":"","MaxResults":"","NextToken":"","Filters":"","SortOrder":""}'
};
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=secretsmanager.ListSecrets',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "IncludePlannedDeletion": "",\n "MaxResults": "",\n "NextToken": "",\n "Filters": "",\n "SortOrder": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets")
.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({
IncludePlannedDeletion: '',
MaxResults: '',
NextToken: '',
Filters: '',
SortOrder: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
IncludePlannedDeletion: '',
MaxResults: '',
NextToken: '',
Filters: '',
SortOrder: ''
},
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=secretsmanager.ListSecrets');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
IncludePlannedDeletion: '',
MaxResults: '',
NextToken: '',
Filters: '',
SortOrder: ''
});
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=secretsmanager.ListSecrets',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
IncludePlannedDeletion: '',
MaxResults: '',
NextToken: '',
Filters: '',
SortOrder: ''
}
};
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=secretsmanager.ListSecrets';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"IncludePlannedDeletion":"","MaxResults":"","NextToken":"","Filters":"","SortOrder":""}'
};
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 = @{ @"IncludePlannedDeletion": @"",
@"MaxResults": @"",
@"NextToken": @"",
@"Filters": @"",
@"SortOrder": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets"]
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=secretsmanager.ListSecrets" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets",
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([
'IncludePlannedDeletion' => '',
'MaxResults' => '',
'NextToken' => '',
'Filters' => '',
'SortOrder' => ''
]),
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=secretsmanager.ListSecrets', [
'body' => '{
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'IncludePlannedDeletion' => '',
'MaxResults' => '',
'NextToken' => '',
'Filters' => '',
'SortOrder' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'IncludePlannedDeletion' => '',
'MaxResults' => '',
'NextToken' => '',
'Filters' => '',
'SortOrder' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets');
$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=secretsmanager.ListSecrets' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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=secretsmanager.ListSecrets"
payload = {
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}
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=secretsmanager.ListSecrets"
payload <- "{\n \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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=secretsmanager.ListSecrets")
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 \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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 \"IncludePlannedDeletion\": \"\",\n \"MaxResults\": \"\",\n \"NextToken\": \"\",\n \"Filters\": \"\",\n \"SortOrder\": \"\"\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=secretsmanager.ListSecrets";
let payload = json!({
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
});
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=secretsmanager.ListSecrets' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}'
echo '{
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "IncludePlannedDeletion": "",\n "MaxResults": "",\n "NextToken": "",\n "Filters": "",\n "SortOrder": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"IncludePlannedDeletion": "",
"MaxResults": "",
"NextToken": "",
"Filters": "",
"SortOrder": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.ListSecrets")! 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
{
"SecretList": [
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Description": "My test database secret",
"LastChangedDate": 1523477145.729,
"Name": "MyTestDatabaseSecret",
"SecretVersionsToStages": {
"EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE": [
"AWSCURRENT"
]
}
},
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret1-d4e5f6",
"Description": "Another secret created for a different database",
"LastChangedDate": 1523482025.685,
"Name": "MyTestDatabaseSecret1",
"SecretVersionsToStages": {
"EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE": [
"AWSCURRENT"
]
}
}
]
}
POST
PutResourcePolicy
{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy");
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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:ResourcePolicy ""
:BlockPublicPolicy ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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=secretsmanager.PutResourcePolicy"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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=secretsmanager.PutResourcePolicy");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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: 71
{
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy")
.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=secretsmanager.PutResourcePolicy")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
ResourcePolicy: '',
BlockPublicPolicy: ''
});
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=secretsmanager.PutResourcePolicy');
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=secretsmanager.PutResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', ResourcePolicy: '', BlockPublicPolicy: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ResourcePolicy":"","BlockPublicPolicy":""}'
};
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=secretsmanager.PutResourcePolicy',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "ResourcePolicy": "",\n "BlockPublicPolicy": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy")
.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({SecretId: '', ResourcePolicy: '', BlockPublicPolicy: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', ResourcePolicy: '', BlockPublicPolicy: ''},
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=secretsmanager.PutResourcePolicy');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
ResourcePolicy: '',
BlockPublicPolicy: ''
});
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=secretsmanager.PutResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', ResourcePolicy: '', BlockPublicPolicy: ''}
};
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=secretsmanager.PutResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ResourcePolicy":"","BlockPublicPolicy":""}'
};
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 = @{ @"SecretId": @"",
@"ResourcePolicy": @"",
@"BlockPublicPolicy": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy"]
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=secretsmanager.PutResourcePolicy" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy",
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([
'SecretId' => '',
'ResourcePolicy' => '',
'BlockPublicPolicy' => ''
]),
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=secretsmanager.PutResourcePolicy', [
'body' => '{
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'ResourcePolicy' => '',
'BlockPublicPolicy' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'ResourcePolicy' => '',
'BlockPublicPolicy' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy');
$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=secretsmanager.PutResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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=secretsmanager.PutResourcePolicy"
payload = {
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}
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=secretsmanager.PutResourcePolicy"
payload <- "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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=secretsmanager.PutResourcePolicy")
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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\",\n \"BlockPublicPolicy\": \"\"\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=secretsmanager.PutResourcePolicy";
let payload = json!({
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
});
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=secretsmanager.PutResourcePolicy' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}'
echo '{
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "ResourcePolicy": "",\n "BlockPublicPolicy": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"ResourcePolicy": "",
"BlockPublicPolicy": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutResourcePolicy")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret"
}
POST
PutSecretValue
{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue");
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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:ClientRequestToken ""
:SecretBinary ""
:SecretString ""
:VersionStages ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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=secretsmanager.PutSecretValue"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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=secretsmanager.PutSecretValue");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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: 115
{
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue")
.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=secretsmanager.PutSecretValue")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
ClientRequestToken: '',
SecretBinary: '',
SecretString: '',
VersionStages: ''
});
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=secretsmanager.PutSecretValue');
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=secretsmanager.PutSecretValue',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
SecretId: '',
ClientRequestToken: '',
SecretBinary: '',
SecretString: '',
VersionStages: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ClientRequestToken":"","SecretBinary":"","SecretString":"","VersionStages":""}'
};
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=secretsmanager.PutSecretValue',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "ClientRequestToken": "",\n "SecretBinary": "",\n "SecretString": "",\n "VersionStages": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue")
.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({
SecretId: '',
ClientRequestToken: '',
SecretBinary: '',
SecretString: '',
VersionStages: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
SecretId: '',
ClientRequestToken: '',
SecretBinary: '',
SecretString: '',
VersionStages: ''
},
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=secretsmanager.PutSecretValue');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
ClientRequestToken: '',
SecretBinary: '',
SecretString: '',
VersionStages: ''
});
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=secretsmanager.PutSecretValue',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
SecretId: '',
ClientRequestToken: '',
SecretBinary: '',
SecretString: '',
VersionStages: ''
}
};
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=secretsmanager.PutSecretValue';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ClientRequestToken":"","SecretBinary":"","SecretString":"","VersionStages":""}'
};
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 = @{ @"SecretId": @"",
@"ClientRequestToken": @"",
@"SecretBinary": @"",
@"SecretString": @"",
@"VersionStages": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue"]
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=secretsmanager.PutSecretValue" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue",
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([
'SecretId' => '',
'ClientRequestToken' => '',
'SecretBinary' => '',
'SecretString' => '',
'VersionStages' => ''
]),
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=secretsmanager.PutSecretValue', [
'body' => '{
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'ClientRequestToken' => '',
'SecretBinary' => '',
'SecretString' => '',
'VersionStages' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'ClientRequestToken' => '',
'SecretBinary' => '',
'SecretString' => '',
'VersionStages' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue');
$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=secretsmanager.PutSecretValue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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=secretsmanager.PutSecretValue"
payload = {
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}
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=secretsmanager.PutSecretValue"
payload <- "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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=secretsmanager.PutSecretValue")
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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\",\n \"VersionStages\": \"\"\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=secretsmanager.PutSecretValue";
let payload = json!({
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
});
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=secretsmanager.PutSecretValue' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}'
echo '{
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "ClientRequestToken": "",\n "SecretBinary": "",\n "SecretString": "",\n "VersionStages": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"ClientRequestToken": "",
"SecretBinary": "",
"SecretString": "",
"VersionStages": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.PutSecretValue")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret",
"VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
"VersionStages": [
"AWSCURRENT"
]
}
POST
RemoveRegionsFromReplication
{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"RemoveReplicaRegions": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication");
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 \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:RemoveReplicaRegions ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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=secretsmanager.RemoveRegionsFromReplication"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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=secretsmanager.RemoveRegionsFromReplication");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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: 50
{
"SecretId": "",
"RemoveReplicaRegions": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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 \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication")
.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=secretsmanager.RemoveRegionsFromReplication")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
RemoveReplicaRegions: ''
});
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=secretsmanager.RemoveRegionsFromReplication');
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=secretsmanager.RemoveRegionsFromReplication',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', RemoveReplicaRegions: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","RemoveReplicaRegions":""}'
};
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=secretsmanager.RemoveRegionsFromReplication',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "RemoveReplicaRegions": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication")
.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({SecretId: '', RemoveReplicaRegions: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', RemoveReplicaRegions: ''},
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=secretsmanager.RemoveRegionsFromReplication');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
RemoveReplicaRegions: ''
});
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=secretsmanager.RemoveRegionsFromReplication',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', RemoveReplicaRegions: ''}
};
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=secretsmanager.RemoveRegionsFromReplication';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","RemoveReplicaRegions":""}'
};
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 = @{ @"SecretId": @"",
@"RemoveReplicaRegions": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication"]
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=secretsmanager.RemoveRegionsFromReplication" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication",
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([
'SecretId' => '',
'RemoveReplicaRegions' => ''
]),
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=secretsmanager.RemoveRegionsFromReplication', [
'body' => '{
"SecretId": "",
"RemoveReplicaRegions": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'RemoveReplicaRegions' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'RemoveReplicaRegions' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication');
$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=secretsmanager.RemoveRegionsFromReplication' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"RemoveReplicaRegions": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"RemoveReplicaRegions": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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=secretsmanager.RemoveRegionsFromReplication"
payload = {
"SecretId": "",
"RemoveReplicaRegions": ""
}
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=secretsmanager.RemoveRegionsFromReplication"
payload <- "{\n \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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=secretsmanager.RemoveRegionsFromReplication")
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 \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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 \"SecretId\": \"\",\n \"RemoveReplicaRegions\": \"\"\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=secretsmanager.RemoveRegionsFromReplication";
let payload = json!({
"SecretId": "",
"RemoveReplicaRegions": ""
});
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=secretsmanager.RemoveRegionsFromReplication' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"RemoveReplicaRegions": ""
}'
echo '{
"SecretId": "",
"RemoveReplicaRegions": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "RemoveReplicaRegions": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"RemoveReplicaRegions": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.RemoveRegionsFromReplication")! 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
ReplicateSecretToRegions
{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions");
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 \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:AddReplicaRegions ""
:ForceOverwriteReplicaSecret ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.ReplicateSecretToRegions"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.ReplicateSecretToRegions");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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: 84
{
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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 \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions")
.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=secretsmanager.ReplicateSecretToRegions")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
});
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=secretsmanager.ReplicateSecretToRegions');
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=secretsmanager.ReplicateSecretToRegions',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', AddReplicaRegions: '', ForceOverwriteReplicaSecret: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","AddReplicaRegions":"","ForceOverwriteReplicaSecret":""}'
};
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=secretsmanager.ReplicateSecretToRegions',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "AddReplicaRegions": "",\n "ForceOverwriteReplicaSecret": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions")
.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({SecretId: '', AddReplicaRegions: '', ForceOverwriteReplicaSecret: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', AddReplicaRegions: '', ForceOverwriteReplicaSecret: ''},
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=secretsmanager.ReplicateSecretToRegions');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
AddReplicaRegions: '',
ForceOverwriteReplicaSecret: ''
});
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=secretsmanager.ReplicateSecretToRegions',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', AddReplicaRegions: '', ForceOverwriteReplicaSecret: ''}
};
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=secretsmanager.ReplicateSecretToRegions';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","AddReplicaRegions":"","ForceOverwriteReplicaSecret":""}'
};
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 = @{ @"SecretId": @"",
@"AddReplicaRegions": @"",
@"ForceOverwriteReplicaSecret": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions"]
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=secretsmanager.ReplicateSecretToRegions" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions",
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([
'SecretId' => '',
'AddReplicaRegions' => '',
'ForceOverwriteReplicaSecret' => ''
]),
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=secretsmanager.ReplicateSecretToRegions', [
'body' => '{
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'AddReplicaRegions' => '',
'ForceOverwriteReplicaSecret' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'AddReplicaRegions' => '',
'ForceOverwriteReplicaSecret' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions');
$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=secretsmanager.ReplicateSecretToRegions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.ReplicateSecretToRegions"
payload = {
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}
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=secretsmanager.ReplicateSecretToRegions"
payload <- "{\n \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.ReplicateSecretToRegions")
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 \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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 \"SecretId\": \"\",\n \"AddReplicaRegions\": \"\",\n \"ForceOverwriteReplicaSecret\": \"\"\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=secretsmanager.ReplicateSecretToRegions";
let payload = json!({
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
});
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=secretsmanager.ReplicateSecretToRegions' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}'
echo '{
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "AddReplicaRegions": "",\n "ForceOverwriteReplicaSecret": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"AddReplicaRegions": "",
"ForceOverwriteReplicaSecret": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.ReplicateSecretToRegions")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestSecret-1a2b3c",
"ReplicationStatus": [
{
"KmsKeyId": "alias/aws/secretsmanager",
"Region": "eu-west-3",
"Status": "InProgress"
}
]
}
POST
RestoreSecret
{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret
HEADERS
X-Amz-Target
BODY json
{
"SecretId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret");
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 \"SecretId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\"\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=secretsmanager.RestoreSecret"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\"\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=secretsmanager.RestoreSecret");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret"
payload := strings.NewReader("{\n \"SecretId\": \"\"\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: 20
{
"SecretId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\"\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 \"SecretId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret")
.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=secretsmanager.RestoreSecret")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: ''
});
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=secretsmanager.RestoreSecret');
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=secretsmanager.RestoreSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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=secretsmanager.RestoreSecret',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret")
.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({SecretId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: ''},
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=secretsmanager.RestoreSecret');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: ''
});
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=secretsmanager.RestoreSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
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=secretsmanager.RestoreSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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 = @{ @"SecretId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret"]
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=secretsmanager.RestoreSecret" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret",
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([
'SecretId' => ''
]),
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=secretsmanager.RestoreSecret', [
'body' => '{
"SecretId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret');
$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=secretsmanager.RestoreSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\"\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=secretsmanager.RestoreSecret"
payload = { "SecretId": "" }
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=secretsmanager.RestoreSecret"
payload <- "{\n \"SecretId\": \"\"\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=secretsmanager.RestoreSecret")
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 \"SecretId\": \"\"\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 \"SecretId\": \"\"\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=secretsmanager.RestoreSecret";
let payload = json!({"SecretId": ""});
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=secretsmanager.RestoreSecret' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": ""
}'
echo '{
"SecretId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["SecretId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.RestoreSecret")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret"
}
POST
RotateSecret
{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret");
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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:ClientRequestToken ""
:RotationLambdaARN ""
:RotationRules ""
:RotateImmediately ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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=secretsmanager.RotateSecret"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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=secretsmanager.RotateSecret");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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: 125
{
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret")
.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=secretsmanager.RotateSecret")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
ClientRequestToken: '',
RotationLambdaARN: '',
RotationRules: '',
RotateImmediately: ''
});
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=secretsmanager.RotateSecret');
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=secretsmanager.RotateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
SecretId: '',
ClientRequestToken: '',
RotationLambdaARN: '',
RotationRules: '',
RotateImmediately: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ClientRequestToken":"","RotationLambdaARN":"","RotationRules":"","RotateImmediately":""}'
};
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=secretsmanager.RotateSecret',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "ClientRequestToken": "",\n "RotationLambdaARN": "",\n "RotationRules": "",\n "RotateImmediately": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret")
.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({
SecretId: '',
ClientRequestToken: '',
RotationLambdaARN: '',
RotationRules: '',
RotateImmediately: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
SecretId: '',
ClientRequestToken: '',
RotationLambdaARN: '',
RotationRules: '',
RotateImmediately: ''
},
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=secretsmanager.RotateSecret');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
ClientRequestToken: '',
RotationLambdaARN: '',
RotationRules: '',
RotateImmediately: ''
});
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=secretsmanager.RotateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
SecretId: '',
ClientRequestToken: '',
RotationLambdaARN: '',
RotationRules: '',
RotateImmediately: ''
}
};
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=secretsmanager.RotateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ClientRequestToken":"","RotationLambdaARN":"","RotationRules":"","RotateImmediately":""}'
};
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 = @{ @"SecretId": @"",
@"ClientRequestToken": @"",
@"RotationLambdaARN": @"",
@"RotationRules": @"",
@"RotateImmediately": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret"]
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=secretsmanager.RotateSecret" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret",
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([
'SecretId' => '',
'ClientRequestToken' => '',
'RotationLambdaARN' => '',
'RotationRules' => '',
'RotateImmediately' => ''
]),
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=secretsmanager.RotateSecret', [
'body' => '{
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'ClientRequestToken' => '',
'RotationLambdaARN' => '',
'RotationRules' => '',
'RotateImmediately' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'ClientRequestToken' => '',
'RotationLambdaARN' => '',
'RotationRules' => '',
'RotateImmediately' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret');
$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=secretsmanager.RotateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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=secretsmanager.RotateSecret"
payload = {
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}
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=secretsmanager.RotateSecret"
payload <- "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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=secretsmanager.RotateSecret")
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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"RotationLambdaARN\": \"\",\n \"RotationRules\": \"\",\n \"RotateImmediately\": \"\"\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=secretsmanager.RotateSecret";
let payload = json!({
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
});
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=secretsmanager.RotateSecret' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}'
echo '{
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "ClientRequestToken": "",\n "RotationLambdaARN": "",\n "RotationRules": "",\n "RotateImmediately": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"ClientRequestToken": "",
"RotationLambdaARN": "",
"RotationRules": "",
"RotateImmediately": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.RotateSecret")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret",
"VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
}
POST
StopReplicationToReplica
{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica
HEADERS
X-Amz-Target
BODY json
{
"SecretId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica");
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 \"SecretId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\"\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=secretsmanager.StopReplicationToReplica"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\"\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=secretsmanager.StopReplicationToReplica");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica"
payload := strings.NewReader("{\n \"SecretId\": \"\"\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: 20
{
"SecretId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\"\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 \"SecretId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica")
.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=secretsmanager.StopReplicationToReplica")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: ''
});
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=secretsmanager.StopReplicationToReplica');
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=secretsmanager.StopReplicationToReplica',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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=secretsmanager.StopReplicationToReplica',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica")
.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({SecretId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: ''},
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=secretsmanager.StopReplicationToReplica');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: ''
});
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=secretsmanager.StopReplicationToReplica',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: ''}
};
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=secretsmanager.StopReplicationToReplica';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":""}'
};
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 = @{ @"SecretId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica"]
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=secretsmanager.StopReplicationToReplica" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica",
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([
'SecretId' => ''
]),
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=secretsmanager.StopReplicationToReplica', [
'body' => '{
"SecretId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica');
$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=secretsmanager.StopReplicationToReplica' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\"\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=secretsmanager.StopReplicationToReplica"
payload = { "SecretId": "" }
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=secretsmanager.StopReplicationToReplica"
payload <- "{\n \"SecretId\": \"\"\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=secretsmanager.StopReplicationToReplica")
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 \"SecretId\": \"\"\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 \"SecretId\": \"\"\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=secretsmanager.StopReplicationToReplica";
let payload = json!({"SecretId": ""});
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=secretsmanager.StopReplicationToReplica' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": ""
}'
echo '{
"SecretId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = ["SecretId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.StopReplicationToReplica")! 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
TagResource
{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"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=secretsmanager.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 \"SecretId\": \"\",\n \"Tags\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:Tags ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\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=secretsmanager.TagResource"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\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=secretsmanager.TagResource");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\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=secretsmanager.TagResource"
payload := strings.NewReader("{\n \"SecretId\": \"\",\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: 34
{
"SecretId": "",
"Tags": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"Tags\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\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 \"SecretId\": \"\",\n \"Tags\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.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=secretsmanager.TagResource")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"Tags\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
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=secretsmanager.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=secretsmanager.TagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', Tags: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","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=secretsmanager.TagResource',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\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 \"SecretId\": \"\",\n \"Tags\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.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({SecretId: '', Tags: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', 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=secretsmanager.TagResource');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
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=secretsmanager.TagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', 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=secretsmanager.TagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","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 = @{ @"SecretId": @"",
@"Tags": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.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=secretsmanager.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 \"SecretId\": \"\",\n \"Tags\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.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([
'SecretId' => '',
'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=secretsmanager.TagResource', [
'body' => '{
"SecretId": "",
"Tags": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'Tags' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'Tags' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.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=secretsmanager.TagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"Tags": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"Tags": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\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=secretsmanager.TagResource"
payload = {
"SecretId": "",
"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=secretsmanager.TagResource"
payload <- "{\n \"SecretId\": \"\",\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=secretsmanager.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 \"SecretId\": \"\",\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 \"SecretId\": \"\",\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=secretsmanager.TagResource";
let payload = json!({
"SecretId": "",
"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=secretsmanager.TagResource' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"Tags": ""
}'
echo '{
"SecretId": "",
"Tags": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "Tags": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.TagResource'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"Tags": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.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=secretsmanager.UntagResource
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"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=secretsmanager.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 \"SecretId\": \"\",\n \"TagKeys\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:TagKeys ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\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=secretsmanager.UntagResource"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\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=secretsmanager.UntagResource");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\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=secretsmanager.UntagResource"
payload := strings.NewReader("{\n \"SecretId\": \"\",\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: 37
{
"SecretId": "",
"TagKeys": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"TagKeys\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\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 \"SecretId\": \"\",\n \"TagKeys\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.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=secretsmanager.UntagResource")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"TagKeys\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
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=secretsmanager.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=secretsmanager.UntagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', TagKeys: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","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=secretsmanager.UntagResource',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\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 \"SecretId\": \"\",\n \"TagKeys\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.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({SecretId: '', TagKeys: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', 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=secretsmanager.UntagResource');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
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=secretsmanager.UntagResource',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', 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=secretsmanager.UntagResource';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","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 = @{ @"SecretId": @"",
@"TagKeys": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.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=secretsmanager.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 \"SecretId\": \"\",\n \"TagKeys\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.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([
'SecretId' => '',
'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=secretsmanager.UntagResource', [
'body' => '{
"SecretId": "",
"TagKeys": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'TagKeys' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'TagKeys' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.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=secretsmanager.UntagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"TagKeys": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"TagKeys": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\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=secretsmanager.UntagResource"
payload = {
"SecretId": "",
"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=secretsmanager.UntagResource"
payload <- "{\n \"SecretId\": \"\",\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=secretsmanager.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 \"SecretId\": \"\",\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 \"SecretId\": \"\",\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=secretsmanager.UntagResource";
let payload = json!({
"SecretId": "",
"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=secretsmanager.UntagResource' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"TagKeys": ""
}'
echo '{
"SecretId": "",
"TagKeys": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "TagKeys": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.UntagResource'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"TagKeys": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.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
UpdateSecret
{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret");
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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:ClientRequestToken ""
:Description ""
:KmsKeyId ""
:SecretBinary ""
:SecretString ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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=secretsmanager.UpdateSecret"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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=secretsmanager.UpdateSecret");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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
{
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret")
.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=secretsmanager.UpdateSecret")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: ''
});
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=secretsmanager.UpdateSecret');
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=secretsmanager.UpdateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
SecretId: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ClientRequestToken":"","Description":"","KmsKeyId":"","SecretBinary":"","SecretString":""}'
};
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=secretsmanager.UpdateSecret',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "ClientRequestToken": "",\n "Description": "",\n "KmsKeyId": "",\n "SecretBinary": "",\n "SecretString": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret")
.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({
SecretId: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {
SecretId: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: ''
},
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=secretsmanager.UpdateSecret');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: ''
});
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=secretsmanager.UpdateSecret',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {
SecretId: '',
ClientRequestToken: '',
Description: '',
KmsKeyId: '',
SecretBinary: '',
SecretString: ''
}
};
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=secretsmanager.UpdateSecret';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ClientRequestToken":"","Description":"","KmsKeyId":"","SecretBinary":"","SecretString":""}'
};
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 = @{ @"SecretId": @"",
@"ClientRequestToken": @"",
@"Description": @"",
@"KmsKeyId": @"",
@"SecretBinary": @"",
@"SecretString": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret"]
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=secretsmanager.UpdateSecret" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret",
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([
'SecretId' => '',
'ClientRequestToken' => '',
'Description' => '',
'KmsKeyId' => '',
'SecretBinary' => '',
'SecretString' => ''
]),
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=secretsmanager.UpdateSecret', [
'body' => '{
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'ClientRequestToken' => '',
'Description' => '',
'KmsKeyId' => '',
'SecretBinary' => '',
'SecretString' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'ClientRequestToken' => '',
'Description' => '',
'KmsKeyId' => '',
'SecretBinary' => '',
'SecretString' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret');
$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=secretsmanager.UpdateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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=secretsmanager.UpdateSecret"
payload = {
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}
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=secretsmanager.UpdateSecret"
payload <- "{\n \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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=secretsmanager.UpdateSecret")
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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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 \"SecretId\": \"\",\n \"ClientRequestToken\": \"\",\n \"Description\": \"\",\n \"KmsKeyId\": \"\",\n \"SecretBinary\": \"\",\n \"SecretString\": \"\"\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=secretsmanager.UpdateSecret";
let payload = json!({
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
});
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=secretsmanager.UpdateSecret' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}'
echo '{
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "ClientRequestToken": "",\n "Description": "",\n "KmsKeyId": "",\n "SecretBinary": "",\n "SecretString": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"ClientRequestToken": "",
"Description": "",
"KmsKeyId": "",
"SecretBinary": "",
"SecretString": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecret")! 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
{
"ARN": "aws:arn:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret",
"VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE"
}
POST
UpdateSecretVersionStage
{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage");
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 \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:VersionStage ""
:RemoveFromVersionId ""
:MoveToVersionId ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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=secretsmanager.UpdateSecretVersionStage"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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=secretsmanager.UpdateSecretVersionStage");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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: 96
{
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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 \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage")
.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=secretsmanager.UpdateSecretVersionStage")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
VersionStage: '',
RemoveFromVersionId: '',
MoveToVersionId: ''
});
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=secretsmanager.UpdateSecretVersionStage');
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=secretsmanager.UpdateSecretVersionStage',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', VersionStage: '', RemoveFromVersionId: '', MoveToVersionId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","VersionStage":"","RemoveFromVersionId":"","MoveToVersionId":""}'
};
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=secretsmanager.UpdateSecretVersionStage',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "VersionStage": "",\n "RemoveFromVersionId": "",\n "MoveToVersionId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage")
.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({SecretId: '', VersionStage: '', RemoveFromVersionId: '', MoveToVersionId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', VersionStage: '', RemoveFromVersionId: '', MoveToVersionId: ''},
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=secretsmanager.UpdateSecretVersionStage');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
VersionStage: '',
RemoveFromVersionId: '',
MoveToVersionId: ''
});
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=secretsmanager.UpdateSecretVersionStage',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', VersionStage: '', RemoveFromVersionId: '', MoveToVersionId: ''}
};
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=secretsmanager.UpdateSecretVersionStage';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","VersionStage":"","RemoveFromVersionId":"","MoveToVersionId":""}'
};
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 = @{ @"SecretId": @"",
@"VersionStage": @"",
@"RemoveFromVersionId": @"",
@"MoveToVersionId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage"]
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=secretsmanager.UpdateSecretVersionStage" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage",
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([
'SecretId' => '',
'VersionStage' => '',
'RemoveFromVersionId' => '',
'MoveToVersionId' => ''
]),
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=secretsmanager.UpdateSecretVersionStage', [
'body' => '{
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'VersionStage' => '',
'RemoveFromVersionId' => '',
'MoveToVersionId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'VersionStage' => '',
'RemoveFromVersionId' => '',
'MoveToVersionId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage');
$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=secretsmanager.UpdateSecretVersionStage' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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=secretsmanager.UpdateSecretVersionStage"
payload = {
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}
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=secretsmanager.UpdateSecretVersionStage"
payload <- "{\n \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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=secretsmanager.UpdateSecretVersionStage")
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 \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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 \"SecretId\": \"\",\n \"VersionStage\": \"\",\n \"RemoveFromVersionId\": \"\",\n \"MoveToVersionId\": \"\"\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=secretsmanager.UpdateSecretVersionStage";
let payload = json!({
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
});
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=secretsmanager.UpdateSecretVersionStage' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}'
echo '{
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "VersionStage": "",\n "RemoveFromVersionId": "",\n "MoveToVersionId": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"VersionStage": "",
"RemoveFromVersionId": "",
"MoveToVersionId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.UpdateSecretVersionStage")! 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
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
"Name": "MyTestDatabaseSecret"
}
POST
ValidateResourcePolicy
{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy
HEADERS
X-Amz-Target
BODY json
{
"SecretId": "",
"ResourcePolicy": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy");
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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy" {:headers {:x-amz-target ""}
:content-type :json
:form-params {:SecretId ""
:ResourcePolicy ""}})
require "http/client"
url = "{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy"
headers = HTTP::Headers{
"x-amz-target" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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=secretsmanager.ValidateResourcePolicy"),
Headers =
{
{ "x-amz-target", "" },
},
Content = new StringContent("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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=secretsmanager.ValidateResourcePolicy");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-amz-target", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy"
payload := strings.NewReader("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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: 44
{
"SecretId": "",
"ResourcePolicy": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy")
.setHeader("x-amz-target", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy"))
.header("x-amz-target", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy")
.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=secretsmanager.ValidateResourcePolicy")
.header("x-amz-target", "")
.header("content-type", "application/json")
.body("{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\n}")
.asString();
const data = JSON.stringify({
SecretId: '',
ResourcePolicy: ''
});
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=secretsmanager.ValidateResourcePolicy');
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=secretsmanager.ValidateResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', ResourcePolicy: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ResourcePolicy":""}'
};
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=secretsmanager.ValidateResourcePolicy',
method: 'POST',
headers: {
'x-amz-target': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "SecretId": "",\n "ResourcePolicy": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy")
.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({SecretId: '', ResourcePolicy: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: {SecretId: '', ResourcePolicy: ''},
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=secretsmanager.ValidateResourcePolicy');
req.headers({
'x-amz-target': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
SecretId: '',
ResourcePolicy: ''
});
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=secretsmanager.ValidateResourcePolicy',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
data: {SecretId: '', ResourcePolicy: ''}
};
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=secretsmanager.ValidateResourcePolicy';
const options = {
method: 'POST',
headers: {'x-amz-target': '', 'content-type': 'application/json'},
body: '{"SecretId":"","ResourcePolicy":""}'
};
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 = @{ @"SecretId": @"",
@"ResourcePolicy": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy"]
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=secretsmanager.ValidateResourcePolicy" in
let headers = Header.add_list (Header.init ()) [
("x-amz-target", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy",
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([
'SecretId' => '',
'ResourcePolicy' => ''
]),
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=secretsmanager.ValidateResourcePolicy', [
'body' => '{
"SecretId": "",
"ResourcePolicy": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-amz-target' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-amz-target' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'SecretId' => '',
'ResourcePolicy' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'SecretId' => '',
'ResourcePolicy' => ''
]));
$request->setRequestUrl('{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy');
$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=secretsmanager.ValidateResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ResourcePolicy": ""
}'
$headers=@{}
$headers.Add("x-amz-target", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"SecretId": "",
"ResourcePolicy": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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=secretsmanager.ValidateResourcePolicy"
payload = {
"SecretId": "",
"ResourcePolicy": ""
}
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=secretsmanager.ValidateResourcePolicy"
payload <- "{\n \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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=secretsmanager.ValidateResourcePolicy")
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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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 \"SecretId\": \"\",\n \"ResourcePolicy\": \"\"\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=secretsmanager.ValidateResourcePolicy";
let payload = json!({
"SecretId": "",
"ResourcePolicy": ""
});
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=secretsmanager.ValidateResourcePolicy' \
--header 'content-type: application/json' \
--header 'x-amz-target: ' \
--data '{
"SecretId": "",
"ResourcePolicy": ""
}'
echo '{
"SecretId": "",
"ResourcePolicy": ""
}' | \
http POST '{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy' \
content-type:application/json \
x-amz-target:''
wget --quiet \
--method POST \
--header 'x-amz-target: ' \
--header 'content-type: application/json' \
--body-data '{\n "SecretId": "",\n "ResourcePolicy": ""\n}' \
--output-document \
- '{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy'
import Foundation
let headers = [
"x-amz-target": "",
"content-type": "application/json"
]
let parameters = [
"SecretId": "",
"ResourcePolicy": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/#X-Amz-Target=secretsmanager.ValidateResourcePolicy")! 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
{
"PolicyValidationPassed": true,
"ValidationErrors": []
}