Cloud Key Management Service (KMS) API
GET
cloudkms.projects.locations.ekmConfig.getIamPolicy
{{baseUrl}}/v1/:+resource:getIamPolicy
QUERY PARAMS
resource
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+resource:getIamPolicy");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+resource:getIamPolicy")
require "http/client"
url = "{{baseUrl}}/v1/:+resource:getIamPolicy"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+resource:getIamPolicy"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+resource:getIamPolicy");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+resource:getIamPolicy"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+resource:getIamPolicy HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+resource:getIamPolicy")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+resource:getIamPolicy"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+resource:getIamPolicy")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+resource:getIamPolicy")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+resource:getIamPolicy');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+resource:getIamPolicy'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+resource:getIamPolicy';
const options = {method: 'GET'};
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}}/v1/:+resource:getIamPolicy',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+resource:getIamPolicy")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+resource:getIamPolicy',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+resource:getIamPolicy'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+resource:getIamPolicy');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+resource:getIamPolicy'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+resource:getIamPolicy';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+resource:getIamPolicy"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+resource:getIamPolicy" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+resource:getIamPolicy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+resource:getIamPolicy');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+resource:getIamPolicy');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+resource:getIamPolicy');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+resource:getIamPolicy' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+resource:getIamPolicy' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+resource:getIamPolicy")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+resource:getIamPolicy"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+resource:getIamPolicy"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+resource:getIamPolicy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+resource:getIamPolicy') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+resource:getIamPolicy";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+resource:getIamPolicy'
http GET '{{baseUrl}}/v1/:+resource:getIamPolicy'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+resource:getIamPolicy'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+resource:getIamPolicy")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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
cloudkms.projects.locations.ekmConfig.setIamPolicy
{{baseUrl}}/v1/:+resource:setIamPolicy
QUERY PARAMS
resource
BODY json
{
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+resource:setIamPolicy");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+resource:setIamPolicy" {:content-type :json
:form-params {:policy {:auditConfigs [{:auditLogConfigs [{:exemptedMembers []
:logType ""}]
:service ""}]
:bindings [{:condition {:description ""
:expression ""
:location ""
:title ""}
:members []
:role ""}]
:etag ""
:version 0}
:updateMask ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+resource:setIamPolicy"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\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}}/v1/:+resource:setIamPolicy"),
Content = new StringContent("{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\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}}/v1/:+resource:setIamPolicy");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+resource:setIamPolicy"
payload := strings.NewReader("{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+resource:setIamPolicy HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 488
{
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+resource:setIamPolicy")
.setHeader("content-type", "application/json")
.setBody("{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+resource:setIamPolicy"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+resource:setIamPolicy")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+resource:setIamPolicy")
.header("content-type", "application/json")
.body("{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}")
.asString();
const data = JSON.stringify({
policy: {
auditConfigs: [
{
auditLogConfigs: [
{
exemptedMembers: [],
logType: ''
}
],
service: ''
}
],
bindings: [
{
condition: {
description: '',
expression: '',
location: '',
title: ''
},
members: [],
role: ''
}
],
etag: '',
version: 0
},
updateMask: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+resource:setIamPolicy');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+resource:setIamPolicy',
headers: {'content-type': 'application/json'},
data: {
policy: {
auditConfigs: [{auditLogConfigs: [{exemptedMembers: [], logType: ''}], service: ''}],
bindings: [
{
condition: {description: '', expression: '', location: '', title: ''},
members: [],
role: ''
}
],
etag: '',
version: 0
},
updateMask: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+resource:setIamPolicy';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"policy":{"auditConfigs":[{"auditLogConfigs":[{"exemptedMembers":[],"logType":""}],"service":""}],"bindings":[{"condition":{"description":"","expression":"","location":"","title":""},"members":[],"role":""}],"etag":"","version":0},"updateMask":""}'
};
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}}/v1/:+resource:setIamPolicy',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "policy": {\n "auditConfigs": [\n {\n "auditLogConfigs": [\n {\n "exemptedMembers": [],\n "logType": ""\n }\n ],\n "service": ""\n }\n ],\n "bindings": [\n {\n "condition": {\n "description": "",\n "expression": "",\n "location": "",\n "title": ""\n },\n "members": [],\n "role": ""\n }\n ],\n "etag": "",\n "version": 0\n },\n "updateMask": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+resource:setIamPolicy")
.post(body)
.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/v1/:+resource:setIamPolicy',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
policy: {
auditConfigs: [{auditLogConfigs: [{exemptedMembers: [], logType: ''}], service: ''}],
bindings: [
{
condition: {description: '', expression: '', location: '', title: ''},
members: [],
role: ''
}
],
etag: '',
version: 0
},
updateMask: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+resource:setIamPolicy',
headers: {'content-type': 'application/json'},
body: {
policy: {
auditConfigs: [{auditLogConfigs: [{exemptedMembers: [], logType: ''}], service: ''}],
bindings: [
{
condition: {description: '', expression: '', location: '', title: ''},
members: [],
role: ''
}
],
etag: '',
version: 0
},
updateMask: ''
},
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}}/v1/:+resource:setIamPolicy');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
policy: {
auditConfigs: [
{
auditLogConfigs: [
{
exemptedMembers: [],
logType: ''
}
],
service: ''
}
],
bindings: [
{
condition: {
description: '',
expression: '',
location: '',
title: ''
},
members: [],
role: ''
}
],
etag: '',
version: 0
},
updateMask: ''
});
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}}/v1/:+resource:setIamPolicy',
headers: {'content-type': 'application/json'},
data: {
policy: {
auditConfigs: [{auditLogConfigs: [{exemptedMembers: [], logType: ''}], service: ''}],
bindings: [
{
condition: {description: '', expression: '', location: '', title: ''},
members: [],
role: ''
}
],
etag: '',
version: 0
},
updateMask: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+resource:setIamPolicy';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"policy":{"auditConfigs":[{"auditLogConfigs":[{"exemptedMembers":[],"logType":""}],"service":""}],"bindings":[{"condition":{"description":"","expression":"","location":"","title":""},"members":[],"role":""}],"etag":"","version":0},"updateMask":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"policy": @{ @"auditConfigs": @[ @{ @"auditLogConfigs": @[ @{ @"exemptedMembers": @[ ], @"logType": @"" } ], @"service": @"" } ], @"bindings": @[ @{ @"condition": @{ @"description": @"", @"expression": @"", @"location": @"", @"title": @"" }, @"members": @[ ], @"role": @"" } ], @"etag": @"", @"version": @0 },
@"updateMask": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+resource:setIamPolicy"]
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}}/v1/:+resource:setIamPolicy" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+resource:setIamPolicy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'policy' => [
'auditConfigs' => [
[
'auditLogConfigs' => [
[
'exemptedMembers' => [
],
'logType' => ''
]
],
'service' => ''
]
],
'bindings' => [
[
'condition' => [
'description' => '',
'expression' => '',
'location' => '',
'title' => ''
],
'members' => [
],
'role' => ''
]
],
'etag' => '',
'version' => 0
],
'updateMask' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+resource:setIamPolicy', [
'body' => '{
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+resource:setIamPolicy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'policy' => [
'auditConfigs' => [
[
'auditLogConfigs' => [
[
'exemptedMembers' => [
],
'logType' => ''
]
],
'service' => ''
]
],
'bindings' => [
[
'condition' => [
'description' => '',
'expression' => '',
'location' => '',
'title' => ''
],
'members' => [
],
'role' => ''
]
],
'etag' => '',
'version' => 0
],
'updateMask' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'policy' => [
'auditConfigs' => [
[
'auditLogConfigs' => [
[
'exemptedMembers' => [
],
'logType' => ''
]
],
'service' => ''
]
],
'bindings' => [
[
'condition' => [
'description' => '',
'expression' => '',
'location' => '',
'title' => ''
],
'members' => [
],
'role' => ''
]
],
'etag' => '',
'version' => 0
],
'updateMask' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+resource:setIamPolicy');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+resource:setIamPolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+resource:setIamPolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+resource:setIamPolicy", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+resource:setIamPolicy"
payload = {
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+resource:setIamPolicy"
payload <- "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+resource:setIamPolicy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\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/v1/:+resource:setIamPolicy') do |req|
req.body = "{\n \"policy\": {\n \"auditConfigs\": [\n {\n \"auditLogConfigs\": [\n {\n \"exemptedMembers\": [],\n \"logType\": \"\"\n }\n ],\n \"service\": \"\"\n }\n ],\n \"bindings\": [\n {\n \"condition\": {\n \"description\": \"\",\n \"expression\": \"\",\n \"location\": \"\",\n \"title\": \"\"\n },\n \"members\": [],\n \"role\": \"\"\n }\n ],\n \"etag\": \"\",\n \"version\": 0\n },\n \"updateMask\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+resource:setIamPolicy";
let payload = json!({
"policy": json!({
"auditConfigs": (
json!({
"auditLogConfigs": (
json!({
"exemptedMembers": (),
"logType": ""
})
),
"service": ""
})
),
"bindings": (
json!({
"condition": json!({
"description": "",
"expression": "",
"location": "",
"title": ""
}),
"members": (),
"role": ""
})
),
"etag": "",
"version": 0
}),
"updateMask": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+resource:setIamPolicy' \
--header 'content-type: application/json' \
--data '{
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}'
echo '{
"policy": {
"auditConfigs": [
{
"auditLogConfigs": [
{
"exemptedMembers": [],
"logType": ""
}
],
"service": ""
}
],
"bindings": [
{
"condition": {
"description": "",
"expression": "",
"location": "",
"title": ""
},
"members": [],
"role": ""
}
],
"etag": "",
"version": 0
},
"updateMask": ""
}' | \
http POST '{{baseUrl}}/v1/:+resource:setIamPolicy' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "policy": {\n "auditConfigs": [\n {\n "auditLogConfigs": [\n {\n "exemptedMembers": [],\n "logType": ""\n }\n ],\n "service": ""\n }\n ],\n "bindings": [\n {\n "condition": {\n "description": "",\n "expression": "",\n "location": "",\n "title": ""\n },\n "members": [],\n "role": ""\n }\n ],\n "etag": "",\n "version": 0\n },\n "updateMask": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+resource:setIamPolicy'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"policy": [
"auditConfigs": [
[
"auditLogConfigs": [
[
"exemptedMembers": [],
"logType": ""
]
],
"service": ""
]
],
"bindings": [
[
"condition": [
"description": "",
"expression": "",
"location": "",
"title": ""
],
"members": [],
"role": ""
]
],
"etag": "",
"version": 0
],
"updateMask": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+resource:setIamPolicy")! 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
cloudkms.projects.locations.ekmConfig.testIamPermissions
{{baseUrl}}/v1/:+resource:testIamPermissions
QUERY PARAMS
resource
BODY json
{
"permissions": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+resource:testIamPermissions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"permissions\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+resource:testIamPermissions" {:content-type :json
:form-params {:permissions []}})
require "http/client"
url = "{{baseUrl}}/v1/:+resource:testIamPermissions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"permissions\": []\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}}/v1/:+resource:testIamPermissions"),
Content = new StringContent("{\n \"permissions\": []\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}}/v1/:+resource:testIamPermissions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"permissions\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+resource:testIamPermissions"
payload := strings.NewReader("{\n \"permissions\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+resource:testIamPermissions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 23
{
"permissions": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+resource:testIamPermissions")
.setHeader("content-type", "application/json")
.setBody("{\n \"permissions\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+resource:testIamPermissions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"permissions\": []\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 \"permissions\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+resource:testIamPermissions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+resource:testIamPermissions")
.header("content-type", "application/json")
.body("{\n \"permissions\": []\n}")
.asString();
const data = JSON.stringify({
permissions: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+resource:testIamPermissions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+resource:testIamPermissions',
headers: {'content-type': 'application/json'},
data: {permissions: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+resource:testIamPermissions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"permissions":[]}'
};
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}}/v1/:+resource:testIamPermissions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "permissions": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"permissions\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+resource:testIamPermissions")
.post(body)
.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/v1/:+resource:testIamPermissions',
headers: {
'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({permissions: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+resource:testIamPermissions',
headers: {'content-type': 'application/json'},
body: {permissions: []},
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}}/v1/:+resource:testIamPermissions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
permissions: []
});
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}}/v1/:+resource:testIamPermissions',
headers: {'content-type': 'application/json'},
data: {permissions: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+resource:testIamPermissions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"permissions":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"permissions": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+resource:testIamPermissions"]
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}}/v1/:+resource:testIamPermissions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"permissions\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+resource:testIamPermissions",
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([
'permissions' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+resource:testIamPermissions', [
'body' => '{
"permissions": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+resource:testIamPermissions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'permissions' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'permissions' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+resource:testIamPermissions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+resource:testIamPermissions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"permissions": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+resource:testIamPermissions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"permissions": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"permissions\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+resource:testIamPermissions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+resource:testIamPermissions"
payload = { "permissions": [] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+resource:testIamPermissions"
payload <- "{\n \"permissions\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+resource:testIamPermissions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"permissions\": []\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/v1/:+resource:testIamPermissions') do |req|
req.body = "{\n \"permissions\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+resource:testIamPermissions";
let payload = json!({"permissions": ()});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+resource:testIamPermissions' \
--header 'content-type: application/json' \
--data '{
"permissions": []
}'
echo '{
"permissions": []
}' | \
http POST '{{baseUrl}}/v1/:+resource:testIamPermissions' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "permissions": []\n}' \
--output-document \
- '{{baseUrl}}/v1/:+resource:testIamPermissions'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["permissions": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+resource:testIamPermissions")! 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
cloudkms.projects.locations.ekmConnections.create
{{baseUrl}}/v1/:+parent/ekmConnections
QUERY PARAMS
parent
BODY json
{
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/ekmConnections");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+parent/ekmConnections" {:content-type :json
:form-params {:createTime ""
:cryptoSpacePath ""
:etag ""
:keyManagementMode ""
:name ""
:serviceResolvers [{:endpointFilter ""
:hostname ""
:serverCertificates [{:issuer ""
:notAfterTime ""
:notBeforeTime ""
:parsed false
:rawDer ""
:serialNumber ""
:sha256Fingerprint ""
:subject ""
:subjectAlternativeDnsNames []}]
:serviceDirectoryService ""}]}})
require "http/client"
url = "{{baseUrl}}/v1/:+parent/ekmConnections"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\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}}/v1/:+parent/ekmConnections"),
Content = new StringContent("{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\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}}/v1/:+parent/ekmConnections");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/ekmConnections"
payload := strings.NewReader("{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+parent/ekmConnections HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 557
{
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+parent/ekmConnections")
.setHeader("content-type", "application/json")
.setBody("{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/ekmConnections"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\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 \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/ekmConnections")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+parent/ekmConnections")
.header("content-type", "application/json")
.body("{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
createTime: '',
cryptoSpacePath: '',
etag: '',
keyManagementMode: '',
name: '',
serviceResolvers: [
{
endpointFilter: '',
hostname: '',
serverCertificates: [
{
issuer: '',
notAfterTime: '',
notBeforeTime: '',
parsed: false,
rawDer: '',
serialNumber: '',
sha256Fingerprint: '',
subject: '',
subjectAlternativeDnsNames: []
}
],
serviceDirectoryService: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+parent/ekmConnections');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/ekmConnections',
headers: {'content-type': 'application/json'},
data: {
createTime: '',
cryptoSpacePath: '',
etag: '',
keyManagementMode: '',
name: '',
serviceResolvers: [
{
endpointFilter: '',
hostname: '',
serverCertificates: [
{
issuer: '',
notAfterTime: '',
notBeforeTime: '',
parsed: false,
rawDer: '',
serialNumber: '',
sha256Fingerprint: '',
subject: '',
subjectAlternativeDnsNames: []
}
],
serviceDirectoryService: ''
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/ekmConnections';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"createTime":"","cryptoSpacePath":"","etag":"","keyManagementMode":"","name":"","serviceResolvers":[{"endpointFilter":"","hostname":"","serverCertificates":[{"issuer":"","notAfterTime":"","notBeforeTime":"","parsed":false,"rawDer":"","serialNumber":"","sha256Fingerprint":"","subject":"","subjectAlternativeDnsNames":[]}],"serviceDirectoryService":""}]}'
};
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}}/v1/:+parent/ekmConnections',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "createTime": "",\n "cryptoSpacePath": "",\n "etag": "",\n "keyManagementMode": "",\n "name": "",\n "serviceResolvers": [\n {\n "endpointFilter": "",\n "hostname": "",\n "serverCertificates": [\n {\n "issuer": "",\n "notAfterTime": "",\n "notBeforeTime": "",\n "parsed": false,\n "rawDer": "",\n "serialNumber": "",\n "sha256Fingerprint": "",\n "subject": "",\n "subjectAlternativeDnsNames": []\n }\n ],\n "serviceDirectoryService": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/ekmConnections")
.post(body)
.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/v1/:+parent/ekmConnections',
headers: {
'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({
createTime: '',
cryptoSpacePath: '',
etag: '',
keyManagementMode: '',
name: '',
serviceResolvers: [
{
endpointFilter: '',
hostname: '',
serverCertificates: [
{
issuer: '',
notAfterTime: '',
notBeforeTime: '',
parsed: false,
rawDer: '',
serialNumber: '',
sha256Fingerprint: '',
subject: '',
subjectAlternativeDnsNames: []
}
],
serviceDirectoryService: ''
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/ekmConnections',
headers: {'content-type': 'application/json'},
body: {
createTime: '',
cryptoSpacePath: '',
etag: '',
keyManagementMode: '',
name: '',
serviceResolvers: [
{
endpointFilter: '',
hostname: '',
serverCertificates: [
{
issuer: '',
notAfterTime: '',
notBeforeTime: '',
parsed: false,
rawDer: '',
serialNumber: '',
sha256Fingerprint: '',
subject: '',
subjectAlternativeDnsNames: []
}
],
serviceDirectoryService: ''
}
]
},
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}}/v1/:+parent/ekmConnections');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
createTime: '',
cryptoSpacePath: '',
etag: '',
keyManagementMode: '',
name: '',
serviceResolvers: [
{
endpointFilter: '',
hostname: '',
serverCertificates: [
{
issuer: '',
notAfterTime: '',
notBeforeTime: '',
parsed: false,
rawDer: '',
serialNumber: '',
sha256Fingerprint: '',
subject: '',
subjectAlternativeDnsNames: []
}
],
serviceDirectoryService: ''
}
]
});
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}}/v1/:+parent/ekmConnections',
headers: {'content-type': 'application/json'},
data: {
createTime: '',
cryptoSpacePath: '',
etag: '',
keyManagementMode: '',
name: '',
serviceResolvers: [
{
endpointFilter: '',
hostname: '',
serverCertificates: [
{
issuer: '',
notAfterTime: '',
notBeforeTime: '',
parsed: false,
rawDer: '',
serialNumber: '',
sha256Fingerprint: '',
subject: '',
subjectAlternativeDnsNames: []
}
],
serviceDirectoryService: ''
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/ekmConnections';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"createTime":"","cryptoSpacePath":"","etag":"","keyManagementMode":"","name":"","serviceResolvers":[{"endpointFilter":"","hostname":"","serverCertificates":[{"issuer":"","notAfterTime":"","notBeforeTime":"","parsed":false,"rawDer":"","serialNumber":"","sha256Fingerprint":"","subject":"","subjectAlternativeDnsNames":[]}],"serviceDirectoryService":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"createTime": @"",
@"cryptoSpacePath": @"",
@"etag": @"",
@"keyManagementMode": @"",
@"name": @"",
@"serviceResolvers": @[ @{ @"endpointFilter": @"", @"hostname": @"", @"serverCertificates": @[ @{ @"issuer": @"", @"notAfterTime": @"", @"notBeforeTime": @"", @"parsed": @NO, @"rawDer": @"", @"serialNumber": @"", @"sha256Fingerprint": @"", @"subject": @"", @"subjectAlternativeDnsNames": @[ ] } ], @"serviceDirectoryService": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/ekmConnections"]
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}}/v1/:+parent/ekmConnections" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/ekmConnections",
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([
'createTime' => '',
'cryptoSpacePath' => '',
'etag' => '',
'keyManagementMode' => '',
'name' => '',
'serviceResolvers' => [
[
'endpointFilter' => '',
'hostname' => '',
'serverCertificates' => [
[
'issuer' => '',
'notAfterTime' => '',
'notBeforeTime' => '',
'parsed' => null,
'rawDer' => '',
'serialNumber' => '',
'sha256Fingerprint' => '',
'subject' => '',
'subjectAlternativeDnsNames' => [
]
]
],
'serviceDirectoryService' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+parent/ekmConnections', [
'body' => '{
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/ekmConnections');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'createTime' => '',
'cryptoSpacePath' => '',
'etag' => '',
'keyManagementMode' => '',
'name' => '',
'serviceResolvers' => [
[
'endpointFilter' => '',
'hostname' => '',
'serverCertificates' => [
[
'issuer' => '',
'notAfterTime' => '',
'notBeforeTime' => '',
'parsed' => null,
'rawDer' => '',
'serialNumber' => '',
'sha256Fingerprint' => '',
'subject' => '',
'subjectAlternativeDnsNames' => [
]
]
],
'serviceDirectoryService' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'createTime' => '',
'cryptoSpacePath' => '',
'etag' => '',
'keyManagementMode' => '',
'name' => '',
'serviceResolvers' => [
[
'endpointFilter' => '',
'hostname' => '',
'serverCertificates' => [
[
'issuer' => '',
'notAfterTime' => '',
'notBeforeTime' => '',
'parsed' => null,
'rawDer' => '',
'serialNumber' => '',
'sha256Fingerprint' => '',
'subject' => '',
'subjectAlternativeDnsNames' => [
]
]
],
'serviceDirectoryService' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+parent/ekmConnections');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/ekmConnections' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/ekmConnections' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+parent/ekmConnections", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/ekmConnections"
payload = {
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": False,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/ekmConnections"
payload <- "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/ekmConnections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\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/v1/:+parent/ekmConnections') do |req|
req.body = "{\n \"createTime\": \"\",\n \"cryptoSpacePath\": \"\",\n \"etag\": \"\",\n \"keyManagementMode\": \"\",\n \"name\": \"\",\n \"serviceResolvers\": [\n {\n \"endpointFilter\": \"\",\n \"hostname\": \"\",\n \"serverCertificates\": [\n {\n \"issuer\": \"\",\n \"notAfterTime\": \"\",\n \"notBeforeTime\": \"\",\n \"parsed\": false,\n \"rawDer\": \"\",\n \"serialNumber\": \"\",\n \"sha256Fingerprint\": \"\",\n \"subject\": \"\",\n \"subjectAlternativeDnsNames\": []\n }\n ],\n \"serviceDirectoryService\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/ekmConnections";
let payload = json!({
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": (
json!({
"endpointFilter": "",
"hostname": "",
"serverCertificates": (
json!({
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": ()
})
),
"serviceDirectoryService": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+parent/ekmConnections' \
--header 'content-type: application/json' \
--data '{
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}'
echo '{
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
{
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
{
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
}
],
"serviceDirectoryService": ""
}
]
}' | \
http POST '{{baseUrl}}/v1/:+parent/ekmConnections' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "createTime": "",\n "cryptoSpacePath": "",\n "etag": "",\n "keyManagementMode": "",\n "name": "",\n "serviceResolvers": [\n {\n "endpointFilter": "",\n "hostname": "",\n "serverCertificates": [\n {\n "issuer": "",\n "notAfterTime": "",\n "notBeforeTime": "",\n "parsed": false,\n "rawDer": "",\n "serialNumber": "",\n "sha256Fingerprint": "",\n "subject": "",\n "subjectAlternativeDnsNames": []\n }\n ],\n "serviceDirectoryService": ""\n }\n ]\n}' \
--output-document \
- '{{baseUrl}}/v1/:+parent/ekmConnections'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"createTime": "",
"cryptoSpacePath": "",
"etag": "",
"keyManagementMode": "",
"name": "",
"serviceResolvers": [
[
"endpointFilter": "",
"hostname": "",
"serverCertificates": [
[
"issuer": "",
"notAfterTime": "",
"notBeforeTime": "",
"parsed": false,
"rawDer": "",
"serialNumber": "",
"sha256Fingerprint": "",
"subject": "",
"subjectAlternativeDnsNames": []
]
],
"serviceDirectoryService": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/ekmConnections")! 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()
GET
cloudkms.projects.locations.ekmConnections.list
{{baseUrl}}/v1/:+parent/ekmConnections
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/ekmConnections");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+parent/ekmConnections")
require "http/client"
url = "{{baseUrl}}/v1/:+parent/ekmConnections"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent/ekmConnections"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent/ekmConnections");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/ekmConnections"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+parent/ekmConnections HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+parent/ekmConnections")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/ekmConnections"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/ekmConnections")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+parent/ekmConnections")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+parent/ekmConnections');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/ekmConnections'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/ekmConnections';
const options = {method: 'GET'};
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}}/v1/:+parent/ekmConnections',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/ekmConnections")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+parent/ekmConnections',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/ekmConnections'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+parent/ekmConnections');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/ekmConnections'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/ekmConnections';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/ekmConnections"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+parent/ekmConnections" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/ekmConnections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+parent/ekmConnections');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/ekmConnections');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+parent/ekmConnections');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/ekmConnections' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/ekmConnections' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+parent/ekmConnections")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/ekmConnections"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/ekmConnections"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/ekmConnections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+parent/ekmConnections') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/ekmConnections";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+parent/ekmConnections'
http GET '{{baseUrl}}/v1/:+parent/ekmConnections'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+parent/ekmConnections'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/ekmConnections")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
GET
cloudkms.projects.locations.ekmConnections.verifyConnectivity
{{baseUrl}}/v1/:+name:verifyConnectivity
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:verifyConnectivity");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+name:verifyConnectivity")
require "http/client"
url = "{{baseUrl}}/v1/:+name:verifyConnectivity"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+name:verifyConnectivity"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+name:verifyConnectivity");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:verifyConnectivity"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+name:verifyConnectivity HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+name:verifyConnectivity")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:verifyConnectivity"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:verifyConnectivity")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+name:verifyConnectivity")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+name:verifyConnectivity');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name:verifyConnectivity'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:verifyConnectivity';
const options = {method: 'GET'};
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}}/v1/:+name:verifyConnectivity',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:verifyConnectivity")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+name:verifyConnectivity',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name:verifyConnectivity'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+name:verifyConnectivity');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name:verifyConnectivity'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:verifyConnectivity';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:verifyConnectivity"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+name:verifyConnectivity" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:verifyConnectivity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+name:verifyConnectivity');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:verifyConnectivity');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+name:verifyConnectivity');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:verifyConnectivity' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:verifyConnectivity' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+name:verifyConnectivity")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:verifyConnectivity"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:verifyConnectivity"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:verifyConnectivity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+name:verifyConnectivity') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:verifyConnectivity";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+name:verifyConnectivity'
http GET '{{baseUrl}}/v1/:+name:verifyConnectivity'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+name:verifyConnectivity'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:verifyConnectivity")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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
cloudkms.projects.locations.generateRandomBytes
{{baseUrl}}/v1/:+location:generateRandomBytes
QUERY PARAMS
location
BODY json
{
"lengthBytes": 0,
"protectionLevel": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+location:generateRandomBytes");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+location:generateRandomBytes" {:content-type :json
:form-params {:lengthBytes 0
:protectionLevel ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+location:generateRandomBytes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\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}}/v1/:+location:generateRandomBytes"),
Content = new StringContent("{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\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}}/v1/:+location:generateRandomBytes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+location:generateRandomBytes"
payload := strings.NewReader("{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+location:generateRandomBytes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 47
{
"lengthBytes": 0,
"protectionLevel": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+location:generateRandomBytes")
.setHeader("content-type", "application/json")
.setBody("{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+location:generateRandomBytes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\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 \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+location:generateRandomBytes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+location:generateRandomBytes")
.header("content-type", "application/json")
.body("{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}")
.asString();
const data = JSON.stringify({
lengthBytes: 0,
protectionLevel: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+location:generateRandomBytes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+location:generateRandomBytes',
headers: {'content-type': 'application/json'},
data: {lengthBytes: 0, protectionLevel: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+location:generateRandomBytes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"lengthBytes":0,"protectionLevel":""}'
};
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}}/v1/:+location:generateRandomBytes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "lengthBytes": 0,\n "protectionLevel": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+location:generateRandomBytes")
.post(body)
.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/v1/:+location:generateRandomBytes',
headers: {
'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({lengthBytes: 0, protectionLevel: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+location:generateRandomBytes',
headers: {'content-type': 'application/json'},
body: {lengthBytes: 0, protectionLevel: ''},
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}}/v1/:+location:generateRandomBytes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
lengthBytes: 0,
protectionLevel: ''
});
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}}/v1/:+location:generateRandomBytes',
headers: {'content-type': 'application/json'},
data: {lengthBytes: 0, protectionLevel: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+location:generateRandomBytes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"lengthBytes":0,"protectionLevel":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"lengthBytes": @0,
@"protectionLevel": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+location:generateRandomBytes"]
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}}/v1/:+location:generateRandomBytes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+location:generateRandomBytes",
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([
'lengthBytes' => 0,
'protectionLevel' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+location:generateRandomBytes', [
'body' => '{
"lengthBytes": 0,
"protectionLevel": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+location:generateRandomBytes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'lengthBytes' => 0,
'protectionLevel' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'lengthBytes' => 0,
'protectionLevel' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+location:generateRandomBytes');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+location:generateRandomBytes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"lengthBytes": 0,
"protectionLevel": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+location:generateRandomBytes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"lengthBytes": 0,
"protectionLevel": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+location:generateRandomBytes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+location:generateRandomBytes"
payload = {
"lengthBytes": 0,
"protectionLevel": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+location:generateRandomBytes"
payload <- "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+location:generateRandomBytes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\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/v1/:+location:generateRandomBytes') do |req|
req.body = "{\n \"lengthBytes\": 0,\n \"protectionLevel\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+location:generateRandomBytes";
let payload = json!({
"lengthBytes": 0,
"protectionLevel": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+location:generateRandomBytes' \
--header 'content-type: application/json' \
--data '{
"lengthBytes": 0,
"protectionLevel": ""
}'
echo '{
"lengthBytes": 0,
"protectionLevel": ""
}' | \
http POST '{{baseUrl}}/v1/:+location:generateRandomBytes' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "lengthBytes": 0,\n "protectionLevel": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+location:generateRandomBytes'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"lengthBytes": 0,
"protectionLevel": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+location:generateRandomBytes")! 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
cloudkms.projects.locations.keyHandles.create
{{baseUrl}}/v1/:+parent/keyHandles
QUERY PARAMS
parent
BODY json
{
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/keyHandles");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+parent/keyHandles" {:content-type :json
:form-params {:kmsKey ""
:name ""
:resourceTypeSelector ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+parent/keyHandles"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\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}}/v1/:+parent/keyHandles"),
Content = new StringContent("{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\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}}/v1/:+parent/keyHandles");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/keyHandles"
payload := strings.NewReader("{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+parent/keyHandles HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 62
{
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+parent/keyHandles")
.setHeader("content-type", "application/json")
.setBody("{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/keyHandles"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\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 \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyHandles")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+parent/keyHandles")
.header("content-type", "application/json")
.body("{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}")
.asString();
const data = JSON.stringify({
kmsKey: '',
name: '',
resourceTypeSelector: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+parent/keyHandles');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/keyHandles',
headers: {'content-type': 'application/json'},
data: {kmsKey: '', name: '', resourceTypeSelector: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/keyHandles';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"kmsKey":"","name":"","resourceTypeSelector":""}'
};
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}}/v1/:+parent/keyHandles',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "kmsKey": "",\n "name": "",\n "resourceTypeSelector": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyHandles")
.post(body)
.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/v1/:+parent/keyHandles',
headers: {
'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({kmsKey: '', name: '', resourceTypeSelector: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/keyHandles',
headers: {'content-type': 'application/json'},
body: {kmsKey: '', name: '', resourceTypeSelector: ''},
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}}/v1/:+parent/keyHandles');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
kmsKey: '',
name: '',
resourceTypeSelector: ''
});
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}}/v1/:+parent/keyHandles',
headers: {'content-type': 'application/json'},
data: {kmsKey: '', name: '', resourceTypeSelector: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/keyHandles';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"kmsKey":"","name":"","resourceTypeSelector":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"kmsKey": @"",
@"name": @"",
@"resourceTypeSelector": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/keyHandles"]
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}}/v1/:+parent/keyHandles" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/keyHandles",
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([
'kmsKey' => '',
'name' => '',
'resourceTypeSelector' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+parent/keyHandles', [
'body' => '{
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/keyHandles');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'kmsKey' => '',
'name' => '',
'resourceTypeSelector' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'kmsKey' => '',
'name' => '',
'resourceTypeSelector' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+parent/keyHandles');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/keyHandles' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/keyHandles' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+parent/keyHandles", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/keyHandles"
payload = {
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/keyHandles"
payload <- "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/keyHandles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\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/v1/:+parent/keyHandles') do |req|
req.body = "{\n \"kmsKey\": \"\",\n \"name\": \"\",\n \"resourceTypeSelector\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/keyHandles";
let payload = json!({
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+parent/keyHandles' \
--header 'content-type: application/json' \
--data '{
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}'
echo '{
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
}' | \
http POST '{{baseUrl}}/v1/:+parent/keyHandles' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "kmsKey": "",\n "name": "",\n "resourceTypeSelector": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+parent/keyHandles'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"kmsKey": "",
"name": "",
"resourceTypeSelector": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/keyHandles")! 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()
GET
cloudkms.projects.locations.keyHandles.list
{{baseUrl}}/v1/:+parent/keyHandles
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/keyHandles");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+parent/keyHandles")
require "http/client"
url = "{{baseUrl}}/v1/:+parent/keyHandles"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent/keyHandles"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent/keyHandles");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/keyHandles"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+parent/keyHandles HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+parent/keyHandles")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/keyHandles"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyHandles")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+parent/keyHandles")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+parent/keyHandles');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/keyHandles'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/keyHandles';
const options = {method: 'GET'};
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}}/v1/:+parent/keyHandles',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyHandles")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+parent/keyHandles',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/keyHandles'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+parent/keyHandles');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/keyHandles'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/keyHandles';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/keyHandles"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+parent/keyHandles" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/keyHandles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+parent/keyHandles');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/keyHandles');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+parent/keyHandles');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/keyHandles' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/keyHandles' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+parent/keyHandles")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/keyHandles"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/keyHandles"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/keyHandles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+parent/keyHandles') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/keyHandles";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+parent/keyHandles'
http GET '{{baseUrl}}/v1/:+parent/keyHandles'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+parent/keyHandles'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/keyHandles")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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
cloudkms.projects.locations.keyRings.create
{{baseUrl}}/v1/:+parent/keyRings
QUERY PARAMS
parent
BODY json
{
"createTime": "",
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/keyRings");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"createTime\": \"\",\n \"name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+parent/keyRings" {:content-type :json
:form-params {:createTime ""
:name ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+parent/keyRings"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"createTime\": \"\",\n \"name\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent/keyRings"),
Content = new StringContent("{\n \"createTime\": \"\",\n \"name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent/keyRings");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"createTime\": \"\",\n \"name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/keyRings"
payload := strings.NewReader("{\n \"createTime\": \"\",\n \"name\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+parent/keyRings HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 36
{
"createTime": "",
"name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+parent/keyRings")
.setHeader("content-type", "application/json")
.setBody("{\n \"createTime\": \"\",\n \"name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/keyRings"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"createTime\": \"\",\n \"name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"createTime\": \"\",\n \"name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyRings")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+parent/keyRings")
.header("content-type", "application/json")
.body("{\n \"createTime\": \"\",\n \"name\": \"\"\n}")
.asString();
const data = JSON.stringify({
createTime: '',
name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+parent/keyRings');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/keyRings',
headers: {'content-type': 'application/json'},
data: {createTime: '', name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/keyRings';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"createTime":"","name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:+parent/keyRings',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "createTime": "",\n "name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"createTime\": \"\",\n \"name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyRings")
.post(body)
.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/v1/:+parent/keyRings',
headers: {
'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({createTime: '', name: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/keyRings',
headers: {'content-type': 'application/json'},
body: {createTime: '', name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/:+parent/keyRings');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
createTime: '',
name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/keyRings',
headers: {'content-type': 'application/json'},
data: {createTime: '', name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/keyRings';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"createTime":"","name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"createTime": @"",
@"name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/keyRings"]
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}}/v1/:+parent/keyRings" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"createTime\": \"\",\n \"name\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/keyRings",
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([
'createTime' => '',
'name' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+parent/keyRings', [
'body' => '{
"createTime": "",
"name": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/keyRings');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'createTime' => '',
'name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'createTime' => '',
'name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+parent/keyRings');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/keyRings' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"createTime": "",
"name": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/keyRings' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"createTime": "",
"name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"createTime\": \"\",\n \"name\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+parent/keyRings", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/keyRings"
payload = {
"createTime": "",
"name": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/keyRings"
payload <- "{\n \"createTime\": \"\",\n \"name\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/keyRings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"createTime\": \"\",\n \"name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/:+parent/keyRings') do |req|
req.body = "{\n \"createTime\": \"\",\n \"name\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/keyRings";
let payload = json!({
"createTime": "",
"name": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+parent/keyRings' \
--header 'content-type: application/json' \
--data '{
"createTime": "",
"name": ""
}'
echo '{
"createTime": "",
"name": ""
}' | \
http POST '{{baseUrl}}/v1/:+parent/keyRings' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "createTime": "",\n "name": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+parent/keyRings'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"createTime": "",
"name": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/keyRings")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.create
{{baseUrl}}/v1/:+parent/cryptoKeys
QUERY PARAMS
parent
BODY json
{
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": {
"allowedAccessReasons": []
},
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/cryptoKeys");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+parent/cryptoKeys" {:content-type :json
:form-params {:createTime ""
:cryptoKeyBackend ""
:destroyScheduledDuration ""
:importOnly false
:keyAccessJustificationsPolicy {:allowedAccessReasons []}
:labels {}
:name ""
:nextRotationTime ""
:primary {:algorithm ""
:attestation {:certChains {:caviumCerts []
:googleCardCerts []
:googlePartitionCerts []}
:content ""
:format ""}
:createTime ""
:destroyEventTime ""
:destroyTime ""
:externalDestructionFailureReason ""
:externalProtectionLevelOptions {:ekmConnectionKeyPath ""
:externalKeyUri ""}
:generateTime ""
:generationFailureReason ""
:importFailureReason ""
:importJob ""
:importTime ""
:name ""
:protectionLevel ""
:reimportEligible false
:state ""}
:purpose ""
:rotationPeriod ""
:versionTemplate {:algorithm ""
:protectionLevel ""}}})
require "http/client"
url = "{{baseUrl}}/v1/:+parent/cryptoKeys"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\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}}/v1/:+parent/cryptoKeys"),
Content = new StringContent("{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\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}}/v1/:+parent/cryptoKeys");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/cryptoKeys"
payload := strings.NewReader("{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+parent/cryptoKeys HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1031
{
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": {
"allowedAccessReasons": []
},
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+parent/cryptoKeys")
.setHeader("content-type", "application/json")
.setBody("{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/cryptoKeys"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\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 \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeys")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+parent/cryptoKeys")
.header("content-type", "application/json")
.body("{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
createTime: '',
cryptoKeyBackend: '',
destroyScheduledDuration: '',
importOnly: false,
keyAccessJustificationsPolicy: {
allowedAccessReasons: []
},
labels: {},
name: '',
nextRotationTime: '',
primary: {
algorithm: '',
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {
ekmConnectionKeyPath: '',
externalKeyUri: ''
},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
purpose: '',
rotationPeriod: '',
versionTemplate: {
algorithm: '',
protectionLevel: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+parent/cryptoKeys');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/cryptoKeys',
headers: {'content-type': 'application/json'},
data: {
createTime: '',
cryptoKeyBackend: '',
destroyScheduledDuration: '',
importOnly: false,
keyAccessJustificationsPolicy: {allowedAccessReasons: []},
labels: {},
name: '',
nextRotationTime: '',
primary: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
purpose: '',
rotationPeriod: '',
versionTemplate: {algorithm: '', protectionLevel: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/cryptoKeys';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"createTime":"","cryptoKeyBackend":"","destroyScheduledDuration":"","importOnly":false,"keyAccessJustificationsPolicy":{"allowedAccessReasons":[]},"labels":{},"name":"","nextRotationTime":"","primary":{"algorithm":"","attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","destroyEventTime":"","destroyTime":"","externalDestructionFailureReason":"","externalProtectionLevelOptions":{"ekmConnectionKeyPath":"","externalKeyUri":""},"generateTime":"","generationFailureReason":"","importFailureReason":"","importJob":"","importTime":"","name":"","protectionLevel":"","reimportEligible":false,"state":""},"purpose":"","rotationPeriod":"","versionTemplate":{"algorithm":"","protectionLevel":""}}'
};
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}}/v1/:+parent/cryptoKeys',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "createTime": "",\n "cryptoKeyBackend": "",\n "destroyScheduledDuration": "",\n "importOnly": false,\n "keyAccessJustificationsPolicy": {\n "allowedAccessReasons": []\n },\n "labels": {},\n "name": "",\n "nextRotationTime": "",\n "primary": {\n "algorithm": "",\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "destroyEventTime": "",\n "destroyTime": "",\n "externalDestructionFailureReason": "",\n "externalProtectionLevelOptions": {\n "ekmConnectionKeyPath": "",\n "externalKeyUri": ""\n },\n "generateTime": "",\n "generationFailureReason": "",\n "importFailureReason": "",\n "importJob": "",\n "importTime": "",\n "name": "",\n "protectionLevel": "",\n "reimportEligible": false,\n "state": ""\n },\n "purpose": "",\n "rotationPeriod": "",\n "versionTemplate": {\n "algorithm": "",\n "protectionLevel": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeys")
.post(body)
.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/v1/:+parent/cryptoKeys',
headers: {
'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({
createTime: '',
cryptoKeyBackend: '',
destroyScheduledDuration: '',
importOnly: false,
keyAccessJustificationsPolicy: {allowedAccessReasons: []},
labels: {},
name: '',
nextRotationTime: '',
primary: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
purpose: '',
rotationPeriod: '',
versionTemplate: {algorithm: '', protectionLevel: ''}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/cryptoKeys',
headers: {'content-type': 'application/json'},
body: {
createTime: '',
cryptoKeyBackend: '',
destroyScheduledDuration: '',
importOnly: false,
keyAccessJustificationsPolicy: {allowedAccessReasons: []},
labels: {},
name: '',
nextRotationTime: '',
primary: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
purpose: '',
rotationPeriod: '',
versionTemplate: {algorithm: '', protectionLevel: ''}
},
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}}/v1/:+parent/cryptoKeys');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
createTime: '',
cryptoKeyBackend: '',
destroyScheduledDuration: '',
importOnly: false,
keyAccessJustificationsPolicy: {
allowedAccessReasons: []
},
labels: {},
name: '',
nextRotationTime: '',
primary: {
algorithm: '',
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {
ekmConnectionKeyPath: '',
externalKeyUri: ''
},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
purpose: '',
rotationPeriod: '',
versionTemplate: {
algorithm: '',
protectionLevel: ''
}
});
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}}/v1/:+parent/cryptoKeys',
headers: {'content-type': 'application/json'},
data: {
createTime: '',
cryptoKeyBackend: '',
destroyScheduledDuration: '',
importOnly: false,
keyAccessJustificationsPolicy: {allowedAccessReasons: []},
labels: {},
name: '',
nextRotationTime: '',
primary: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
purpose: '',
rotationPeriod: '',
versionTemplate: {algorithm: '', protectionLevel: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/cryptoKeys';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"createTime":"","cryptoKeyBackend":"","destroyScheduledDuration":"","importOnly":false,"keyAccessJustificationsPolicy":{"allowedAccessReasons":[]},"labels":{},"name":"","nextRotationTime":"","primary":{"algorithm":"","attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","destroyEventTime":"","destroyTime":"","externalDestructionFailureReason":"","externalProtectionLevelOptions":{"ekmConnectionKeyPath":"","externalKeyUri":""},"generateTime":"","generationFailureReason":"","importFailureReason":"","importJob":"","importTime":"","name":"","protectionLevel":"","reimportEligible":false,"state":""},"purpose":"","rotationPeriod":"","versionTemplate":{"algorithm":"","protectionLevel":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"createTime": @"",
@"cryptoKeyBackend": @"",
@"destroyScheduledDuration": @"",
@"importOnly": @NO,
@"keyAccessJustificationsPolicy": @{ @"allowedAccessReasons": @[ ] },
@"labels": @{ },
@"name": @"",
@"nextRotationTime": @"",
@"primary": @{ @"algorithm": @"", @"attestation": @{ @"certChains": @{ @"caviumCerts": @[ ], @"googleCardCerts": @[ ], @"googlePartitionCerts": @[ ] }, @"content": @"", @"format": @"" }, @"createTime": @"", @"destroyEventTime": @"", @"destroyTime": @"", @"externalDestructionFailureReason": @"", @"externalProtectionLevelOptions": @{ @"ekmConnectionKeyPath": @"", @"externalKeyUri": @"" }, @"generateTime": @"", @"generationFailureReason": @"", @"importFailureReason": @"", @"importJob": @"", @"importTime": @"", @"name": @"", @"protectionLevel": @"", @"reimportEligible": @NO, @"state": @"" },
@"purpose": @"",
@"rotationPeriod": @"",
@"versionTemplate": @{ @"algorithm": @"", @"protectionLevel": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/cryptoKeys"]
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}}/v1/:+parent/cryptoKeys" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/cryptoKeys",
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([
'createTime' => '',
'cryptoKeyBackend' => '',
'destroyScheduledDuration' => '',
'importOnly' => null,
'keyAccessJustificationsPolicy' => [
'allowedAccessReasons' => [
]
],
'labels' => [
],
'name' => '',
'nextRotationTime' => '',
'primary' => [
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
],
'purpose' => '',
'rotationPeriod' => '',
'versionTemplate' => [
'algorithm' => '',
'protectionLevel' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+parent/cryptoKeys', [
'body' => '{
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": {
"allowedAccessReasons": []
},
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/cryptoKeys');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'createTime' => '',
'cryptoKeyBackend' => '',
'destroyScheduledDuration' => '',
'importOnly' => null,
'keyAccessJustificationsPolicy' => [
'allowedAccessReasons' => [
]
],
'labels' => [
],
'name' => '',
'nextRotationTime' => '',
'primary' => [
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
],
'purpose' => '',
'rotationPeriod' => '',
'versionTemplate' => [
'algorithm' => '',
'protectionLevel' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'createTime' => '',
'cryptoKeyBackend' => '',
'destroyScheduledDuration' => '',
'importOnly' => null,
'keyAccessJustificationsPolicy' => [
'allowedAccessReasons' => [
]
],
'labels' => [
],
'name' => '',
'nextRotationTime' => '',
'primary' => [
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
],
'purpose' => '',
'rotationPeriod' => '',
'versionTemplate' => [
'algorithm' => '',
'protectionLevel' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+parent/cryptoKeys');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/cryptoKeys' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": {
"allowedAccessReasons": []
},
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/cryptoKeys' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": {
"allowedAccessReasons": []
},
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+parent/cryptoKeys", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/cryptoKeys"
payload = {
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": False,
"keyAccessJustificationsPolicy": { "allowedAccessReasons": [] },
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": False,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/cryptoKeys"
payload <- "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/cryptoKeys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\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/v1/:+parent/cryptoKeys') do |req|
req.body = "{\n \"createTime\": \"\",\n \"cryptoKeyBackend\": \"\",\n \"destroyScheduledDuration\": \"\",\n \"importOnly\": false,\n \"keyAccessJustificationsPolicy\": {\n \"allowedAccessReasons\": []\n },\n \"labels\": {},\n \"name\": \"\",\n \"nextRotationTime\": \"\",\n \"primary\": {\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n },\n \"purpose\": \"\",\n \"rotationPeriod\": \"\",\n \"versionTemplate\": {\n \"algorithm\": \"\",\n \"protectionLevel\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/cryptoKeys";
let payload = json!({
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": json!({"allowedAccessReasons": ()}),
"labels": json!({}),
"name": "",
"nextRotationTime": "",
"primary": json!({
"algorithm": "",
"attestation": json!({
"certChains": json!({
"caviumCerts": (),
"googleCardCerts": (),
"googlePartitionCerts": ()
}),
"content": "",
"format": ""
}),
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": json!({
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
}),
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}),
"purpose": "",
"rotationPeriod": "",
"versionTemplate": json!({
"algorithm": "",
"protectionLevel": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+parent/cryptoKeys' \
--header 'content-type: application/json' \
--data '{
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": {
"allowedAccessReasons": []
},
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}'
echo '{
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": {
"allowedAccessReasons": []
},
"labels": {},
"name": "",
"nextRotationTime": "",
"primary": {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
},
"purpose": "",
"rotationPeriod": "",
"versionTemplate": {
"algorithm": "",
"protectionLevel": ""
}
}' | \
http POST '{{baseUrl}}/v1/:+parent/cryptoKeys' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "createTime": "",\n "cryptoKeyBackend": "",\n "destroyScheduledDuration": "",\n "importOnly": false,\n "keyAccessJustificationsPolicy": {\n "allowedAccessReasons": []\n },\n "labels": {},\n "name": "",\n "nextRotationTime": "",\n "primary": {\n "algorithm": "",\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "destroyEventTime": "",\n "destroyTime": "",\n "externalDestructionFailureReason": "",\n "externalProtectionLevelOptions": {\n "ekmConnectionKeyPath": "",\n "externalKeyUri": ""\n },\n "generateTime": "",\n "generationFailureReason": "",\n "importFailureReason": "",\n "importJob": "",\n "importTime": "",\n "name": "",\n "protectionLevel": "",\n "reimportEligible": false,\n "state": ""\n },\n "purpose": "",\n "rotationPeriod": "",\n "versionTemplate": {\n "algorithm": "",\n "protectionLevel": ""\n }\n}' \
--output-document \
- '{{baseUrl}}/v1/:+parent/cryptoKeys'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"createTime": "",
"cryptoKeyBackend": "",
"destroyScheduledDuration": "",
"importOnly": false,
"keyAccessJustificationsPolicy": ["allowedAccessReasons": []],
"labels": [],
"name": "",
"nextRotationTime": "",
"primary": [
"algorithm": "",
"attestation": [
"certChains": [
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
],
"content": "",
"format": ""
],
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": [
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
],
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
],
"purpose": "",
"rotationPeriod": "",
"versionTemplate": [
"algorithm": "",
"protectionLevel": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/cryptoKeys")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricDecrypt
{{baseUrl}}/v1/:+name:asymmetricDecrypt
QUERY PARAMS
name
BODY json
{
"ciphertext": "",
"ciphertextCrc32c": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:asymmetricDecrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:asymmetricDecrypt" {:content-type :json
:form-params {:ciphertext ""
:ciphertextCrc32c ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:asymmetricDecrypt"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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}}/v1/:+name:asymmetricDecrypt"),
Content = new StringContent("{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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}}/v1/:+name:asymmetricDecrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:asymmetricDecrypt"
payload := strings.NewReader("{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:asymmetricDecrypt HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 48
{
"ciphertext": "",
"ciphertextCrc32c": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:asymmetricDecrypt")
.setHeader("content-type", "application/json")
.setBody("{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:asymmetricDecrypt"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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 \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:asymmetricDecrypt")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:asymmetricDecrypt")
.header("content-type", "application/json")
.body("{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
.asString();
const data = JSON.stringify({
ciphertext: '',
ciphertextCrc32c: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:asymmetricDecrypt');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:asymmetricDecrypt',
headers: {'content-type': 'application/json'},
data: {ciphertext: '', ciphertextCrc32c: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:asymmetricDecrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"ciphertext":"","ciphertextCrc32c":""}'
};
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}}/v1/:+name:asymmetricDecrypt',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "ciphertext": "",\n "ciphertextCrc32c": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:asymmetricDecrypt")
.post(body)
.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/v1/:+name:asymmetricDecrypt',
headers: {
'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({ciphertext: '', ciphertextCrc32c: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:asymmetricDecrypt',
headers: {'content-type': 'application/json'},
body: {ciphertext: '', ciphertextCrc32c: ''},
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}}/v1/:+name:asymmetricDecrypt');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
ciphertext: '',
ciphertextCrc32c: ''
});
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}}/v1/:+name:asymmetricDecrypt',
headers: {'content-type': 'application/json'},
data: {ciphertext: '', ciphertextCrc32c: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:asymmetricDecrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"ciphertext":"","ciphertextCrc32c":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"ciphertext": @"",
@"ciphertextCrc32c": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:asymmetricDecrypt"]
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}}/v1/:+name:asymmetricDecrypt" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:asymmetricDecrypt",
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([
'ciphertext' => '',
'ciphertextCrc32c' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:asymmetricDecrypt', [
'body' => '{
"ciphertext": "",
"ciphertextCrc32c": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:asymmetricDecrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'ciphertext' => '',
'ciphertextCrc32c' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'ciphertext' => '',
'ciphertextCrc32c' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:asymmetricDecrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:asymmetricDecrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ciphertext": "",
"ciphertextCrc32c": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:asymmetricDecrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ciphertext": "",
"ciphertextCrc32c": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:asymmetricDecrypt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:asymmetricDecrypt"
payload = {
"ciphertext": "",
"ciphertextCrc32c": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:asymmetricDecrypt"
payload <- "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:asymmetricDecrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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/v1/:+name:asymmetricDecrypt') do |req|
req.body = "{\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:asymmetricDecrypt";
let payload = json!({
"ciphertext": "",
"ciphertextCrc32c": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:asymmetricDecrypt' \
--header 'content-type: application/json' \
--data '{
"ciphertext": "",
"ciphertextCrc32c": ""
}'
echo '{
"ciphertext": "",
"ciphertextCrc32c": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:asymmetricDecrypt' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "ciphertext": "",\n "ciphertextCrc32c": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:asymmetricDecrypt'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"ciphertext": "",
"ciphertextCrc32c": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:asymmetricDecrypt")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricSign
{{baseUrl}}/v1/:+name:asymmetricSign
QUERY PARAMS
name
BODY json
{
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:asymmetricSign");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:asymmetricSign" {:content-type :json
:form-params {:data ""
:dataCrc32c ""
:digest {:sha256 ""
:sha384 ""
:sha512 ""}
:digestCrc32c ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:asymmetricSign"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\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}}/v1/:+name:asymmetricSign"),
Content = new StringContent("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\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}}/v1/:+name:asymmetricSign");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:asymmetricSign"
payload := strings.NewReader("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:asymmetricSign HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 130
{
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:asymmetricSign")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:asymmetricSign"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\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 \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:asymmetricSign")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:asymmetricSign")
.header("content-type", "application/json")
.body("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}")
.asString();
const data = JSON.stringify({
data: '',
dataCrc32c: '',
digest: {
sha256: '',
sha384: '',
sha512: ''
},
digestCrc32c: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:asymmetricSign');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:asymmetricSign',
headers: {'content-type': 'application/json'},
data: {
data: '',
dataCrc32c: '',
digest: {sha256: '', sha384: '', sha512: ''},
digestCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:asymmetricSign';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":"","dataCrc32c":"","digest":{"sha256":"","sha384":"","sha512":""},"digestCrc32c":""}'
};
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}}/v1/:+name:asymmetricSign',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": "",\n "dataCrc32c": "",\n "digest": {\n "sha256": "",\n "sha384": "",\n "sha512": ""\n },\n "digestCrc32c": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:asymmetricSign")
.post(body)
.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/v1/:+name:asymmetricSign',
headers: {
'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({
data: '',
dataCrc32c: '',
digest: {sha256: '', sha384: '', sha512: ''},
digestCrc32c: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:asymmetricSign',
headers: {'content-type': 'application/json'},
body: {
data: '',
dataCrc32c: '',
digest: {sha256: '', sha384: '', sha512: ''},
digestCrc32c: ''
},
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}}/v1/:+name:asymmetricSign');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: '',
dataCrc32c: '',
digest: {
sha256: '',
sha384: '',
sha512: ''
},
digestCrc32c: ''
});
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}}/v1/:+name:asymmetricSign',
headers: {'content-type': 'application/json'},
data: {
data: '',
dataCrc32c: '',
digest: {sha256: '', sha384: '', sha512: ''},
digestCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:asymmetricSign';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":"","dataCrc32c":"","digest":{"sha256":"","sha384":"","sha512":""},"digestCrc32c":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @"",
@"dataCrc32c": @"",
@"digest": @{ @"sha256": @"", @"sha384": @"", @"sha512": @"" },
@"digestCrc32c": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:asymmetricSign"]
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}}/v1/:+name:asymmetricSign" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:asymmetricSign",
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([
'data' => '',
'dataCrc32c' => '',
'digest' => [
'sha256' => '',
'sha384' => '',
'sha512' => ''
],
'digestCrc32c' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:asymmetricSign', [
'body' => '{
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:asymmetricSign');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => '',
'dataCrc32c' => '',
'digest' => [
'sha256' => '',
'sha384' => '',
'sha512' => ''
],
'digestCrc32c' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => '',
'dataCrc32c' => '',
'digest' => [
'sha256' => '',
'sha384' => '',
'sha512' => ''
],
'digestCrc32c' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:asymmetricSign');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:asymmetricSign' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:asymmetricSign' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:asymmetricSign", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:asymmetricSign"
payload = {
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:asymmetricSign"
payload <- "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:asymmetricSign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\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/v1/:+name:asymmetricSign') do |req|
req.body = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"digest\": {\n \"sha256\": \"\",\n \"sha384\": \"\",\n \"sha512\": \"\"\n },\n \"digestCrc32c\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:asymmetricSign";
let payload = json!({
"data": "",
"dataCrc32c": "",
"digest": json!({
"sha256": "",
"sha384": "",
"sha512": ""
}),
"digestCrc32c": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:asymmetricSign' \
--header 'content-type: application/json' \
--data '{
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}'
echo '{
"data": "",
"dataCrc32c": "",
"digest": {
"sha256": "",
"sha384": "",
"sha512": ""
},
"digestCrc32c": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:asymmetricSign' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": "",\n "dataCrc32c": "",\n "digest": {\n "sha256": "",\n "sha384": "",\n "sha512": ""\n },\n "digestCrc32c": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:asymmetricSign'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"data": "",
"dataCrc32c": "",
"digest": [
"sha256": "",
"sha384": "",
"sha512": ""
],
"digestCrc32c": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:asymmetricSign")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.create
{{baseUrl}}/v1/:+parent/cryptoKeyVersions
QUERY PARAMS
parent
BODY json
{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/cryptoKeyVersions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+parent/cryptoKeyVersions" {:content-type :json
:form-params {:algorithm ""
:attestation {:certChains {:caviumCerts []
:googleCardCerts []
:googlePartitionCerts []}
:content ""
:format ""}
:createTime ""
:destroyEventTime ""
:destroyTime ""
:externalDestructionFailureReason ""
:externalProtectionLevelOptions {:ekmConnectionKeyPath ""
:externalKeyUri ""}
:generateTime ""
:generationFailureReason ""
:importFailureReason ""
:importJob ""
:importTime ""
:name ""
:protectionLevel ""
:reimportEligible false
:state ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\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}}/v1/:+parent/cryptoKeyVersions"),
Content = new StringContent("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\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}}/v1/:+parent/cryptoKeyVersions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
payload := strings.NewReader("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+parent/cryptoKeyVersions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 610
{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.setHeader("content-type", "application/json")
.setBody("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/cryptoKeyVersions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\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 \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.header("content-type", "application/json")
.body("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
.asString();
const data = JSON.stringify({
algorithm: '',
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {
ekmConnectionKeyPath: '',
externalKeyUri: ''
},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/cryptoKeyVersions',
headers: {'content-type': 'application/json'},
data: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/cryptoKeyVersions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"algorithm":"","attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","destroyEventTime":"","destroyTime":"","externalDestructionFailureReason":"","externalProtectionLevelOptions":{"ekmConnectionKeyPath":"","externalKeyUri":""},"generateTime":"","generationFailureReason":"","importFailureReason":"","importJob":"","importTime":"","name":"","protectionLevel":"","reimportEligible":false,"state":""}'
};
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}}/v1/:+parent/cryptoKeyVersions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "algorithm": "",\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "destroyEventTime": "",\n "destroyTime": "",\n "externalDestructionFailureReason": "",\n "externalProtectionLevelOptions": {\n "ekmConnectionKeyPath": "",\n "externalKeyUri": ""\n },\n "generateTime": "",\n "generationFailureReason": "",\n "importFailureReason": "",\n "importJob": "",\n "importTime": "",\n "name": "",\n "protectionLevel": "",\n "reimportEligible": false,\n "state": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.post(body)
.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/v1/:+parent/cryptoKeyVersions',
headers: {
'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({
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/cryptoKeyVersions',
headers: {'content-type': 'application/json'},
body: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
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}}/v1/:+parent/cryptoKeyVersions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
algorithm: '',
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {
ekmConnectionKeyPath: '',
externalKeyUri: ''
},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
});
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}}/v1/:+parent/cryptoKeyVersions',
headers: {'content-type': 'application/json'},
data: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/cryptoKeyVersions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"algorithm":"","attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","destroyEventTime":"","destroyTime":"","externalDestructionFailureReason":"","externalProtectionLevelOptions":{"ekmConnectionKeyPath":"","externalKeyUri":""},"generateTime":"","generationFailureReason":"","importFailureReason":"","importJob":"","importTime":"","name":"","protectionLevel":"","reimportEligible":false,"state":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"algorithm": @"",
@"attestation": @{ @"certChains": @{ @"caviumCerts": @[ ], @"googleCardCerts": @[ ], @"googlePartitionCerts": @[ ] }, @"content": @"", @"format": @"" },
@"createTime": @"",
@"destroyEventTime": @"",
@"destroyTime": @"",
@"externalDestructionFailureReason": @"",
@"externalProtectionLevelOptions": @{ @"ekmConnectionKeyPath": @"", @"externalKeyUri": @"" },
@"generateTime": @"",
@"generationFailureReason": @"",
@"importFailureReason": @"",
@"importJob": @"",
@"importTime": @"",
@"name": @"",
@"protectionLevel": @"",
@"reimportEligible": @NO,
@"state": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/cryptoKeyVersions"]
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}}/v1/:+parent/cryptoKeyVersions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/cryptoKeyVersions",
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([
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+parent/cryptoKeyVersions', [
'body' => '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/cryptoKeyVersions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/cryptoKeyVersions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+parent/cryptoKeyVersions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
payload = {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": False,
"state": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
payload <- "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\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/v1/:+parent/cryptoKeyVersions') do |req|
req.body = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions";
let payload = json!({
"algorithm": "",
"attestation": json!({
"certChains": json!({
"caviumCerts": (),
"googleCardCerts": (),
"googlePartitionCerts": ()
}),
"content": "",
"format": ""
}),
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": json!({
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
}),
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+parent/cryptoKeyVersions' \
--header 'content-type: application/json' \
--data '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}'
echo '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}' | \
http POST '{{baseUrl}}/v1/:+parent/cryptoKeyVersions' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "algorithm": "",\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "destroyEventTime": "",\n "destroyTime": "",\n "externalDestructionFailureReason": "",\n "externalProtectionLevelOptions": {\n "ekmConnectionKeyPath": "",\n "externalKeyUri": ""\n },\n "generateTime": "",\n "generationFailureReason": "",\n "importFailureReason": "",\n "importJob": "",\n "importTime": "",\n "name": "",\n "protectionLevel": "",\n "reimportEligible": false,\n "state": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+parent/cryptoKeyVersions'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"algorithm": "",
"attestation": [
"certChains": [
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
],
"content": "",
"format": ""
],
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": [
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
],
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/cryptoKeyVersions")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.destroy
{{baseUrl}}/v1/:+name:destroy
QUERY PARAMS
name
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:destroy");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:destroy" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/v1/:+name:destroy"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
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}}/v1/:+name:destroy"),
Content = new StringContent("{}")
{
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}}/v1/:+name:destroy");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:destroy"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:destroy HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:destroy")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:destroy"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.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, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:destroy")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:destroy")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:destroy');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:destroy',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:destroy';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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}}/v1/:+name:destroy',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:destroy")
.post(body)
.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/v1/:+name:destroy',
headers: {
'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({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:destroy',
headers: {'content-type': 'application/json'},
body: {},
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}}/v1/:+name:destroy');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
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}}/v1/:+name:destroy',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:destroy';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:destroy"]
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}}/v1/:+name:destroy" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:destroy",
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([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:destroy', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:destroy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:destroy');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:destroy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:destroy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:destroy", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:destroy"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:destroy"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:destroy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
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/v1/:+name:destroy') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:destroy";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:destroy' \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST '{{baseUrl}}/v1/:+name:destroy' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- '{{baseUrl}}/v1/:+name:destroy'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:destroy")! 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()
GET
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.getPublicKey
{{baseUrl}}/v1/:+name/publicKey
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name/publicKey");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+name/publicKey")
require "http/client"
url = "{{baseUrl}}/v1/:+name/publicKey"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+name/publicKey"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+name/publicKey");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name/publicKey"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+name/publicKey HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+name/publicKey")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name/publicKey"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name/publicKey")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+name/publicKey")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+name/publicKey');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name/publicKey'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name/publicKey';
const options = {method: 'GET'};
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}}/v1/:+name/publicKey',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name/publicKey")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+name/publicKey',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name/publicKey'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+name/publicKey');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name/publicKey'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name/publicKey';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name/publicKey"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+name/publicKey" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name/publicKey",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+name/publicKey');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name/publicKey');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+name/publicKey');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name/publicKey' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name/publicKey' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+name/publicKey")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name/publicKey"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name/publicKey"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name/publicKey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+name/publicKey') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name/publicKey";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+name/publicKey'
http GET '{{baseUrl}}/v1/:+name/publicKey'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+name/publicKey'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name/publicKey")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.import
{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import
QUERY PARAMS
parent
BODY json
{
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import" {:content-type :json
:form-params {:algorithm ""
:cryptoKeyVersion ""
:importJob ""
:rsaAesWrappedKey ""
:wrappedKey ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\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}}/v1/:+parent/cryptoKeyVersions:import"),
Content = new StringContent("{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\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}}/v1/:+parent/cryptoKeyVersions:import");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import"
payload := strings.NewReader("{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+parent/cryptoKeyVersions:import HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 112
{
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import")
.setHeader("content-type", "application/json")
.setBody("{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\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 \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import")
.header("content-type", "application/json")
.body("{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}")
.asString();
const data = JSON.stringify({
algorithm: '',
cryptoKeyVersion: '',
importJob: '',
rsaAesWrappedKey: '',
wrappedKey: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import',
headers: {'content-type': 'application/json'},
data: {
algorithm: '',
cryptoKeyVersion: '',
importJob: '',
rsaAesWrappedKey: '',
wrappedKey: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"algorithm":"","cryptoKeyVersion":"","importJob":"","rsaAesWrappedKey":"","wrappedKey":""}'
};
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}}/v1/:+parent/cryptoKeyVersions:import',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "algorithm": "",\n "cryptoKeyVersion": "",\n "importJob": "",\n "rsaAesWrappedKey": "",\n "wrappedKey": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import")
.post(body)
.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/v1/:+parent/cryptoKeyVersions:import',
headers: {
'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({
algorithm: '',
cryptoKeyVersion: '',
importJob: '',
rsaAesWrappedKey: '',
wrappedKey: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import',
headers: {'content-type': 'application/json'},
body: {
algorithm: '',
cryptoKeyVersion: '',
importJob: '',
rsaAesWrappedKey: '',
wrappedKey: ''
},
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}}/v1/:+parent/cryptoKeyVersions:import');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
algorithm: '',
cryptoKeyVersion: '',
importJob: '',
rsaAesWrappedKey: '',
wrappedKey: ''
});
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}}/v1/:+parent/cryptoKeyVersions:import',
headers: {'content-type': 'application/json'},
data: {
algorithm: '',
cryptoKeyVersion: '',
importJob: '',
rsaAesWrappedKey: '',
wrappedKey: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"algorithm":"","cryptoKeyVersion":"","importJob":"","rsaAesWrappedKey":"","wrappedKey":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"algorithm": @"",
@"cryptoKeyVersion": @"",
@"importJob": @"",
@"rsaAesWrappedKey": @"",
@"wrappedKey": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import"]
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}}/v1/:+parent/cryptoKeyVersions:import" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'algorithm' => '',
'cryptoKeyVersion' => '',
'importJob' => '',
'rsaAesWrappedKey' => '',
'wrappedKey' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import', [
'body' => '{
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'algorithm' => '',
'cryptoKeyVersion' => '',
'importJob' => '',
'rsaAesWrappedKey' => '',
'wrappedKey' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'algorithm' => '',
'cryptoKeyVersion' => '',
'importJob' => '',
'rsaAesWrappedKey' => '',
'wrappedKey' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+parent/cryptoKeyVersions:import", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import"
payload = {
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import"
payload <- "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\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/v1/:+parent/cryptoKeyVersions:import') do |req|
req.body = "{\n \"algorithm\": \"\",\n \"cryptoKeyVersion\": \"\",\n \"importJob\": \"\",\n \"rsaAesWrappedKey\": \"\",\n \"wrappedKey\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import";
let payload = json!({
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+parent/cryptoKeyVersions:import' \
--header 'content-type: application/json' \
--data '{
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}'
echo '{
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
}' | \
http POST '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "algorithm": "",\n "cryptoKeyVersion": "",\n "importJob": "",\n "rsaAesWrappedKey": "",\n "wrappedKey": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"algorithm": "",
"cryptoKeyVersion": "",
"importJob": "",
"rsaAesWrappedKey": "",
"wrappedKey": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/cryptoKeyVersions:import")! 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()
GET
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.list
{{baseUrl}}/v1/:+parent/cryptoKeyVersions
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/cryptoKeyVersions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
require "http/client"
url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent/cryptoKeyVersions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent/cryptoKeyVersions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+parent/cryptoKeyVersions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/cryptoKeyVersions"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:+parent/cryptoKeyVersions'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/cryptoKeyVersions';
const options = {method: 'GET'};
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}}/v1/:+parent/cryptoKeyVersions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+parent/cryptoKeyVersions',
headers: {}
};
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.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:+parent/cryptoKeyVersions'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:+parent/cryptoKeyVersions'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/cryptoKeyVersions';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/cryptoKeyVersions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+parent/cryptoKeyVersions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/cryptoKeyVersions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+parent/cryptoKeyVersions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/cryptoKeyVersions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/cryptoKeyVersions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+parent/cryptoKeyVersions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/cryptoKeyVersions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/cryptoKeyVersions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+parent/cryptoKeyVersions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/cryptoKeyVersions";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+parent/cryptoKeyVersions'
http GET '{{baseUrl}}/v1/:+parent/cryptoKeyVersions'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+parent/cryptoKeyVersions'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/cryptoKeyVersions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.macSign
{{baseUrl}}/v1/:+name:macSign
QUERY PARAMS
name
BODY json
{
"data": "",
"dataCrc32c": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:macSign");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:macSign" {:content-type :json
:form-params {:data ""
:dataCrc32c ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:macSign"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\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}}/v1/:+name:macSign"),
Content = new StringContent("{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\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}}/v1/:+name:macSign");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:macSign"
payload := strings.NewReader("{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:macSign HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 36
{
"data": "",
"dataCrc32c": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:macSign")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:macSign"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\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 \"data\": \"\",\n \"dataCrc32c\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:macSign")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:macSign")
.header("content-type", "application/json")
.body("{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}")
.asString();
const data = JSON.stringify({
data: '',
dataCrc32c: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:macSign');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:macSign',
headers: {'content-type': 'application/json'},
data: {data: '', dataCrc32c: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:macSign';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":"","dataCrc32c":""}'
};
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}}/v1/:+name:macSign',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": "",\n "dataCrc32c": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:macSign")
.post(body)
.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/v1/:+name:macSign',
headers: {
'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({data: '', dataCrc32c: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:macSign',
headers: {'content-type': 'application/json'},
body: {data: '', dataCrc32c: ''},
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}}/v1/:+name:macSign');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: '',
dataCrc32c: ''
});
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}}/v1/:+name:macSign',
headers: {'content-type': 'application/json'},
data: {data: '', dataCrc32c: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:macSign';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":"","dataCrc32c":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @"",
@"dataCrc32c": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:macSign"]
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}}/v1/:+name:macSign" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:macSign",
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([
'data' => '',
'dataCrc32c' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:macSign', [
'body' => '{
"data": "",
"dataCrc32c": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:macSign');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => '',
'dataCrc32c' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => '',
'dataCrc32c' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:macSign');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:macSign' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": "",
"dataCrc32c": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:macSign' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": "",
"dataCrc32c": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:macSign", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:macSign"
payload = {
"data": "",
"dataCrc32c": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:macSign"
payload <- "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:macSign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\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/v1/:+name:macSign') do |req|
req.body = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:macSign";
let payload = json!({
"data": "",
"dataCrc32c": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:macSign' \
--header 'content-type: application/json' \
--data '{
"data": "",
"dataCrc32c": ""
}'
echo '{
"data": "",
"dataCrc32c": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:macSign' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": "",\n "dataCrc32c": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:macSign'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"data": "",
"dataCrc32c": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:macSign")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.macVerify
{{baseUrl}}/v1/:+name:macVerify
QUERY PARAMS
name
BODY json
{
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:macVerify");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:macVerify" {:content-type :json
:form-params {:data ""
:dataCrc32c ""
:mac ""
:macCrc32c ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:macVerify"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\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}}/v1/:+name:macVerify"),
Content = new StringContent("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\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}}/v1/:+name:macVerify");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:macVerify"
payload := strings.NewReader("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:macVerify HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 68
{
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:macVerify")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:macVerify"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\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 \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:macVerify")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:macVerify")
.header("content-type", "application/json")
.body("{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}")
.asString();
const data = JSON.stringify({
data: '',
dataCrc32c: '',
mac: '',
macCrc32c: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:macVerify');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:macVerify',
headers: {'content-type': 'application/json'},
data: {data: '', dataCrc32c: '', mac: '', macCrc32c: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:macVerify';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":"","dataCrc32c":"","mac":"","macCrc32c":""}'
};
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}}/v1/:+name:macVerify',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": "",\n "dataCrc32c": "",\n "mac": "",\n "macCrc32c": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:macVerify")
.post(body)
.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/v1/:+name:macVerify',
headers: {
'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({data: '', dataCrc32c: '', mac: '', macCrc32c: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:macVerify',
headers: {'content-type': 'application/json'},
body: {data: '', dataCrc32c: '', mac: '', macCrc32c: ''},
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}}/v1/:+name:macVerify');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: '',
dataCrc32c: '',
mac: '',
macCrc32c: ''
});
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}}/v1/:+name:macVerify',
headers: {'content-type': 'application/json'},
data: {data: '', dataCrc32c: '', mac: '', macCrc32c: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:macVerify';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":"","dataCrc32c":"","mac":"","macCrc32c":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @"",
@"dataCrc32c": @"",
@"mac": @"",
@"macCrc32c": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:macVerify"]
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}}/v1/:+name:macVerify" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:macVerify",
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([
'data' => '',
'dataCrc32c' => '',
'mac' => '',
'macCrc32c' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:macVerify', [
'body' => '{
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:macVerify');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => '',
'dataCrc32c' => '',
'mac' => '',
'macCrc32c' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => '',
'dataCrc32c' => '',
'mac' => '',
'macCrc32c' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:macVerify');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:macVerify' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:macVerify' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:macVerify", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:macVerify"
payload = {
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:macVerify"
payload <- "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:macVerify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\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/v1/:+name:macVerify') do |req|
req.body = "{\n \"data\": \"\",\n \"dataCrc32c\": \"\",\n \"mac\": \"\",\n \"macCrc32c\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:macVerify";
let payload = json!({
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:macVerify' \
--header 'content-type: application/json' \
--data '{
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}'
echo '{
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:macVerify' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": "",\n "dataCrc32c": "",\n "mac": "",\n "macCrc32c": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:macVerify'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"data": "",
"dataCrc32c": "",
"mac": "",
"macCrc32c": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:macVerify")! 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()
PATCH
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.patch
{{baseUrl}}/v1/:+name
QUERY PARAMS
name
BODY json
{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/v1/:+name" {:content-type :json
:form-params {:algorithm ""
:attestation {:certChains {:caviumCerts []
:googleCardCerts []
:googlePartitionCerts []}
:content ""
:format ""}
:createTime ""
:destroyEventTime ""
:destroyTime ""
:externalDestructionFailureReason ""
:externalProtectionLevelOptions {:ekmConnectionKeyPath ""
:externalKeyUri ""}
:generateTime ""
:generationFailureReason ""
:importFailureReason ""
:importJob ""
:importTime ""
:name ""
:protectionLevel ""
:reimportEligible false
:state ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/v1/:+name"),
Content = new StringContent("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\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}}/v1/:+name");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name"
payload := strings.NewReader("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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))
}
PATCH /baseUrl/v1/:+name HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 610
{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/v1/:+name")
.setHeader("content-type", "application/json")
.setBody("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\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 \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/v1/:+name")
.header("content-type", "application/json")
.body("{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
.asString();
const data = JSON.stringify({
algorithm: '',
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {
ekmConnectionKeyPath: '',
externalKeyUri: ''
},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/v1/:+name');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v1/:+name',
headers: {'content-type': 'application/json'},
data: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"algorithm":"","attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","destroyEventTime":"","destroyTime":"","externalDestructionFailureReason":"","externalProtectionLevelOptions":{"ekmConnectionKeyPath":"","externalKeyUri":""},"generateTime":"","generationFailureReason":"","importFailureReason":"","importJob":"","importTime":"","name":"","protectionLevel":"","reimportEligible":false,"state":""}'
};
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}}/v1/:+name',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "algorithm": "",\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "destroyEventTime": "",\n "destroyTime": "",\n "externalDestructionFailureReason": "",\n "externalProtectionLevelOptions": {\n "ekmConnectionKeyPath": "",\n "externalKeyUri": ""\n },\n "generateTime": "",\n "generationFailureReason": "",\n "importFailureReason": "",\n "importJob": "",\n "importTime": "",\n "name": "",\n "protectionLevel": "",\n "reimportEligible": false,\n "state": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+name',
headers: {
'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({
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v1/:+name',
headers: {'content-type': 'application/json'},
body: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/v1/:+name');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
algorithm: '',
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {
ekmConnectionKeyPath: '',
externalKeyUri: ''
},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v1/:+name',
headers: {'content-type': 'application/json'},
data: {
algorithm: '',
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
destroyEventTime: '',
destroyTime: '',
externalDestructionFailureReason: '',
externalProtectionLevelOptions: {ekmConnectionKeyPath: '', externalKeyUri: ''},
generateTime: '',
generationFailureReason: '',
importFailureReason: '',
importJob: '',
importTime: '',
name: '',
protectionLevel: '',
reimportEligible: false,
state: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"algorithm":"","attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","destroyEventTime":"","destroyTime":"","externalDestructionFailureReason":"","externalProtectionLevelOptions":{"ekmConnectionKeyPath":"","externalKeyUri":""},"generateTime":"","generationFailureReason":"","importFailureReason":"","importJob":"","importTime":"","name":"","protectionLevel":"","reimportEligible":false,"state":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"algorithm": @"",
@"attestation": @{ @"certChains": @{ @"caviumCerts": @[ ], @"googleCardCerts": @[ ], @"googlePartitionCerts": @[ ] }, @"content": @"", @"format": @"" },
@"createTime": @"",
@"destroyEventTime": @"",
@"destroyTime": @"",
@"externalDestructionFailureReason": @"",
@"externalProtectionLevelOptions": @{ @"ekmConnectionKeyPath": @"", @"externalKeyUri": @"" },
@"generateTime": @"",
@"generationFailureReason": @"",
@"importFailureReason": @"",
@"importJob": @"",
@"importTime": @"",
@"name": @"",
@"protectionLevel": @"",
@"reimportEligible": @NO,
@"state": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[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}}/v1/:+name" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/v1/:+name', [
'body' => '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'algorithm' => '',
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'destroyEventTime' => '',
'destroyTime' => '',
'externalDestructionFailureReason' => '',
'externalProtectionLevelOptions' => [
'ekmConnectionKeyPath' => '',
'externalKeyUri' => ''
],
'generateTime' => '',
'generationFailureReason' => '',
'importFailureReason' => '',
'importJob' => '',
'importTime' => '',
'name' => '',
'protectionLevel' => '',
'reimportEligible' => null,
'state' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/v1/:+name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name"
payload = {
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": False,
"state": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name"
payload <- "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\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.patch('/baseUrl/v1/:+name') do |req|
req.body = "{\n \"algorithm\": \"\",\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"destroyEventTime\": \"\",\n \"destroyTime\": \"\",\n \"externalDestructionFailureReason\": \"\",\n \"externalProtectionLevelOptions\": {\n \"ekmConnectionKeyPath\": \"\",\n \"externalKeyUri\": \"\"\n },\n \"generateTime\": \"\",\n \"generationFailureReason\": \"\",\n \"importFailureReason\": \"\",\n \"importJob\": \"\",\n \"importTime\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"reimportEligible\": false,\n \"state\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name";
let payload = json!({
"algorithm": "",
"attestation": json!({
"certChains": json!({
"caviumCerts": (),
"googleCardCerts": (),
"googlePartitionCerts": ()
}),
"content": "",
"format": ""
}),
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": json!({
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
}),
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url '{{baseUrl}}/v1/:+name' \
--header 'content-type: application/json' \
--data '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}'
echo '{
"algorithm": "",
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": {
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
},
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
}' | \
http PATCH '{{baseUrl}}/v1/:+name' \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "algorithm": "",\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "destroyEventTime": "",\n "destroyTime": "",\n "externalDestructionFailureReason": "",\n "externalProtectionLevelOptions": {\n "ekmConnectionKeyPath": "",\n "externalKeyUri": ""\n },\n "generateTime": "",\n "generationFailureReason": "",\n "importFailureReason": "",\n "importJob": "",\n "importTime": "",\n "name": "",\n "protectionLevel": "",\n "reimportEligible": false,\n "state": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"algorithm": "",
"attestation": [
"certChains": [
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
],
"content": "",
"format": ""
],
"createTime": "",
"destroyEventTime": "",
"destroyTime": "",
"externalDestructionFailureReason": "",
"externalProtectionLevelOptions": [
"ekmConnectionKeyPath": "",
"externalKeyUri": ""
],
"generateTime": "",
"generationFailureReason": "",
"importFailureReason": "",
"importJob": "",
"importTime": "",
"name": "",
"protectionLevel": "",
"reimportEligible": false,
"state": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.rawDecrypt
{{baseUrl}}/v1/:+name:rawDecrypt
QUERY PARAMS
name
BODY json
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:rawDecrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:rawDecrypt" {:content-type :json
:form-params {:additionalAuthenticatedData ""
:additionalAuthenticatedDataCrc32c ""
:ciphertext ""
:ciphertextCrc32c ""
:initializationVector ""
:initializationVectorCrc32c ""
:tagLength 0}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:rawDecrypt"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\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}}/v1/:+name:rawDecrypt"),
Content = new StringContent("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\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}}/v1/:+name:rawDecrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:rawDecrypt"
payload := strings.NewReader("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:rawDecrypt HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 212
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:rawDecrypt")
.setHeader("content-type", "application/json")
.setBody("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:rawDecrypt"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\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 \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:rawDecrypt")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:rawDecrypt")
.header("content-type", "application/json")
.body("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}")
.asString();
const data = JSON.stringify({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
tagLength: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:rawDecrypt');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:rawDecrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
tagLength: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:rawDecrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","ciphertext":"","ciphertextCrc32c":"","initializationVector":"","initializationVectorCrc32c":"","tagLength":0}'
};
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}}/v1/:+name:rawDecrypt',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "ciphertext": "",\n "ciphertextCrc32c": "",\n "initializationVector": "",\n "initializationVectorCrc32c": "",\n "tagLength": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:rawDecrypt")
.post(body)
.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/v1/:+name:rawDecrypt',
headers: {
'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({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
tagLength: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:rawDecrypt',
headers: {'content-type': 'application/json'},
body: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
tagLength: 0
},
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}}/v1/:+name:rawDecrypt');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
tagLength: 0
});
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}}/v1/:+name:rawDecrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
tagLength: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:rawDecrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","ciphertext":"","ciphertextCrc32c":"","initializationVector":"","initializationVectorCrc32c":"","tagLength":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"additionalAuthenticatedData": @"",
@"additionalAuthenticatedDataCrc32c": @"",
@"ciphertext": @"",
@"ciphertextCrc32c": @"",
@"initializationVector": @"",
@"initializationVectorCrc32c": @"",
@"tagLength": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:rawDecrypt"]
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}}/v1/:+name:rawDecrypt" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:rawDecrypt",
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([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'ciphertext' => '',
'ciphertextCrc32c' => '',
'initializationVector' => '',
'initializationVectorCrc32c' => '',
'tagLength' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:rawDecrypt', [
'body' => '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:rawDecrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'ciphertext' => '',
'ciphertextCrc32c' => '',
'initializationVector' => '',
'initializationVectorCrc32c' => '',
'tagLength' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'ciphertext' => '',
'ciphertextCrc32c' => '',
'initializationVector' => '',
'initializationVectorCrc32c' => '',
'tagLength' => 0
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:rawDecrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:rawDecrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:rawDecrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:rawDecrypt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:rawDecrypt"
payload = {
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:rawDecrypt"
payload <- "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:rawDecrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\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/v1/:+name:rawDecrypt') do |req|
req.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"tagLength\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:rawDecrypt";
let payload = json!({
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:rawDecrypt' \
--header 'content-type: application/json' \
--data '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}'
echo '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
}' | \
http POST '{{baseUrl}}/v1/:+name:rawDecrypt' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "ciphertext": "",\n "ciphertextCrc32c": "",\n "initializationVector": "",\n "initializationVectorCrc32c": "",\n "tagLength": 0\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:rawDecrypt'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"tagLength": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:rawDecrypt")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.rawEncrypt
{{baseUrl}}/v1/:+name:rawEncrypt
QUERY PARAMS
name
BODY json
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:rawEncrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:rawEncrypt" {:content-type :json
:form-params {:additionalAuthenticatedData ""
:additionalAuthenticatedDataCrc32c ""
:initializationVector ""
:initializationVectorCrc32c ""
:plaintext ""
:plaintextCrc32c ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:rawEncrypt"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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}}/v1/:+name:rawEncrypt"),
Content = new StringContent("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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}}/v1/:+name:rawEncrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:rawEncrypt"
payload := strings.NewReader("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:rawEncrypt HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 192
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:rawEncrypt")
.setHeader("content-type", "application/json")
.setBody("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:rawEncrypt"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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 \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:rawEncrypt")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:rawEncrypt")
.header("content-type", "application/json")
.body("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
.asString();
const data = JSON.stringify({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:rawEncrypt');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:rawEncrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:rawEncrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","initializationVector":"","initializationVectorCrc32c":"","plaintext":"","plaintextCrc32c":""}'
};
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}}/v1/:+name:rawEncrypt',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "initializationVector": "",\n "initializationVectorCrc32c": "",\n "plaintext": "",\n "plaintextCrc32c": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:rawEncrypt")
.post(body)
.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/v1/:+name:rawEncrypt',
headers: {
'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({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:rawEncrypt',
headers: {'content-type': 'application/json'},
body: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
},
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}}/v1/:+name:rawEncrypt');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
});
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}}/v1/:+name:rawEncrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
initializationVector: '',
initializationVectorCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:rawEncrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","initializationVector":"","initializationVectorCrc32c":"","plaintext":"","plaintextCrc32c":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"additionalAuthenticatedData": @"",
@"additionalAuthenticatedDataCrc32c": @"",
@"initializationVector": @"",
@"initializationVectorCrc32c": @"",
@"plaintext": @"",
@"plaintextCrc32c": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:rawEncrypt"]
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}}/v1/:+name:rawEncrypt" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:rawEncrypt",
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([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'initializationVector' => '',
'initializationVectorCrc32c' => '',
'plaintext' => '',
'plaintextCrc32c' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:rawEncrypt', [
'body' => '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:rawEncrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'initializationVector' => '',
'initializationVectorCrc32c' => '',
'plaintext' => '',
'plaintextCrc32c' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'initializationVector' => '',
'initializationVectorCrc32c' => '',
'plaintext' => '',
'plaintextCrc32c' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:rawEncrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:rawEncrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:rawEncrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:rawEncrypt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:rawEncrypt"
payload = {
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:rawEncrypt"
payload <- "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:rawEncrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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/v1/:+name:rawEncrypt') do |req|
req.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"initializationVector\": \"\",\n \"initializationVectorCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:rawEncrypt";
let payload = json!({
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:rawEncrypt' \
--header 'content-type: application/json' \
--data '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}'
echo '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:rawEncrypt' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "initializationVector": "",\n "initializationVectorCrc32c": "",\n "plaintext": "",\n "plaintextCrc32c": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:rawEncrypt'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"initializationVector": "",
"initializationVectorCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:rawEncrypt")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.restore
{{baseUrl}}/v1/:+name:restore
QUERY PARAMS
name
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:restore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:restore" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/v1/:+name:restore"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
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}}/v1/:+name:restore"),
Content = new StringContent("{}")
{
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}}/v1/:+name:restore");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:restore"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:restore HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:restore")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:restore"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.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, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:restore")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:restore")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:restore');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:restore',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:restore';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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}}/v1/:+name:restore',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:restore")
.post(body)
.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/v1/:+name:restore',
headers: {
'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({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:restore',
headers: {'content-type': 'application/json'},
body: {},
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}}/v1/:+name:restore');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
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}}/v1/:+name:restore',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:restore';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:restore"]
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}}/v1/:+name:restore" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:restore",
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([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:restore', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:restore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:restore');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:restore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:restore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:restore", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:restore"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:restore"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:restore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
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/v1/:+name:restore') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:restore";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:restore' \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST '{{baseUrl}}/v1/:+name:restore' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- '{{baseUrl}}/v1/:+name:restore'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:restore")! 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
cloudkms.projects.locations.keyRings.cryptoKeys.decrypt
{{baseUrl}}/v1/:+name:decrypt
QUERY PARAMS
name
BODY json
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:decrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:decrypt" {:content-type :json
:form-params {:additionalAuthenticatedData ""
:additionalAuthenticatedDataCrc32c ""
:ciphertext ""
:ciphertextCrc32c ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:decrypt"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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}}/v1/:+name:decrypt"),
Content = new StringContent("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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}}/v1/:+name:decrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:decrypt"
payload := strings.NewReader("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:decrypt HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 128
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:decrypt")
.setHeader("content-type", "application/json")
.setBody("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:decrypt"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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 \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:decrypt")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:decrypt")
.header("content-type", "application/json")
.body("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
.asString();
const data = JSON.stringify({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:decrypt');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:decrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:decrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","ciphertext":"","ciphertextCrc32c":""}'
};
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}}/v1/:+name:decrypt',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "ciphertext": "",\n "ciphertextCrc32c": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:decrypt")
.post(body)
.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/v1/:+name:decrypt',
headers: {
'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({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:decrypt',
headers: {'content-type': 'application/json'},
body: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: ''
},
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}}/v1/:+name:decrypt');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: ''
});
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}}/v1/:+name:decrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
ciphertext: '',
ciphertextCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:decrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","ciphertext":"","ciphertextCrc32c":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"additionalAuthenticatedData": @"",
@"additionalAuthenticatedDataCrc32c": @"",
@"ciphertext": @"",
@"ciphertextCrc32c": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:decrypt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:+name:decrypt" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:decrypt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'ciphertext' => '',
'ciphertextCrc32c' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:decrypt', [
'body' => '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:decrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'ciphertext' => '',
'ciphertextCrc32c' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'ciphertext' => '',
'ciphertextCrc32c' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:decrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:decrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:decrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:decrypt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:decrypt"
payload = {
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:decrypt"
payload <- "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:decrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\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/v1/:+name:decrypt') do |req|
req.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"ciphertext\": \"\",\n \"ciphertextCrc32c\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:decrypt";
let payload = json!({
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:decrypt' \
--header 'content-type: application/json' \
--data '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}'
echo '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:decrypt' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "ciphertext": "",\n "ciphertextCrc32c": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:decrypt'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"ciphertext": "",
"ciphertextCrc32c": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:decrypt")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
cloudkms.projects.locations.keyRings.cryptoKeys.encrypt
{{baseUrl}}/v1/:+name:encrypt
QUERY PARAMS
name
BODY json
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:encrypt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:encrypt" {:content-type :json
:form-params {:additionalAuthenticatedData ""
:additionalAuthenticatedDataCrc32c ""
:plaintext ""
:plaintextCrc32c ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:encrypt"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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}}/v1/:+name:encrypt"),
Content = new StringContent("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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}}/v1/:+name:encrypt");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:encrypt"
payload := strings.NewReader("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:encrypt HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 126
{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:encrypt")
.setHeader("content-type", "application/json")
.setBody("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:encrypt"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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 \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:encrypt")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:encrypt")
.header("content-type", "application/json")
.body("{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
.asString();
const data = JSON.stringify({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:encrypt');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:encrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:encrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","plaintext":"","plaintextCrc32c":""}'
};
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}}/v1/:+name:encrypt',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "plaintext": "",\n "plaintextCrc32c": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:encrypt")
.post(body)
.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/v1/:+name:encrypt',
headers: {
'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({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:encrypt',
headers: {'content-type': 'application/json'},
body: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
},
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}}/v1/:+name:encrypt');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
});
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}}/v1/:+name:encrypt',
headers: {'content-type': 'application/json'},
data: {
additionalAuthenticatedData: '',
additionalAuthenticatedDataCrc32c: '',
plaintext: '',
plaintextCrc32c: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:encrypt';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additionalAuthenticatedData":"","additionalAuthenticatedDataCrc32c":"","plaintext":"","plaintextCrc32c":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"additionalAuthenticatedData": @"",
@"additionalAuthenticatedDataCrc32c": @"",
@"plaintext": @"",
@"plaintextCrc32c": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:encrypt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:+name:encrypt" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:encrypt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'plaintext' => '',
'plaintextCrc32c' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:encrypt', [
'body' => '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:encrypt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'plaintext' => '',
'plaintextCrc32c' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'additionalAuthenticatedData' => '',
'additionalAuthenticatedDataCrc32c' => '',
'plaintext' => '',
'plaintextCrc32c' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:encrypt');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:encrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:encrypt' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:encrypt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:encrypt"
payload = {
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:encrypt"
payload <- "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:encrypt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\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/v1/:+name:encrypt') do |req|
req.body = "{\n \"additionalAuthenticatedData\": \"\",\n \"additionalAuthenticatedDataCrc32c\": \"\",\n \"plaintext\": \"\",\n \"plaintextCrc32c\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:encrypt";
let payload = json!({
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:encrypt' \
--header 'content-type: application/json' \
--data '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}'
echo '{
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:encrypt' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "additionalAuthenticatedData": "",\n "additionalAuthenticatedDataCrc32c": "",\n "plaintext": "",\n "plaintextCrc32c": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:encrypt'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"additionalAuthenticatedData": "",
"additionalAuthenticatedDataCrc32c": "",
"plaintext": "",
"plaintextCrc32c": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:encrypt")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
cloudkms.projects.locations.keyRings.cryptoKeys.list
{{baseUrl}}/v1/:+parent/cryptoKeys
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/cryptoKeys");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+parent/cryptoKeys")
require "http/client"
url = "{{baseUrl}}/v1/:+parent/cryptoKeys"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent/cryptoKeys"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent/cryptoKeys");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/cryptoKeys"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+parent/cryptoKeys HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+parent/cryptoKeys")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/cryptoKeys"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeys")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+parent/cryptoKeys")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+parent/cryptoKeys');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/cryptoKeys'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/cryptoKeys';
const options = {method: 'GET'};
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}}/v1/:+parent/cryptoKeys',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/cryptoKeys")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+parent/cryptoKeys',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/cryptoKeys'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+parent/cryptoKeys');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/cryptoKeys'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/cryptoKeys';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/cryptoKeys"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+parent/cryptoKeys" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/cryptoKeys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+parent/cryptoKeys');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/cryptoKeys');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+parent/cryptoKeys');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/cryptoKeys' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/cryptoKeys' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+parent/cryptoKeys")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/cryptoKeys"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/cryptoKeys"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/cryptoKeys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+parent/cryptoKeys') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/cryptoKeys";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+parent/cryptoKeys'
http GET '{{baseUrl}}/v1/:+parent/cryptoKeys'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+parent/cryptoKeys'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/cryptoKeys")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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
cloudkms.projects.locations.keyRings.cryptoKeys.updatePrimaryVersion
{{baseUrl}}/v1/:+name:updatePrimaryVersion
QUERY PARAMS
name
BODY json
{
"cryptoKeyVersionId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name:updatePrimaryVersion");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cryptoKeyVersionId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+name:updatePrimaryVersion" {:content-type :json
:form-params {:cryptoKeyVersionId ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+name:updatePrimaryVersion"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cryptoKeyVersionId\": \"\"\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}}/v1/:+name:updatePrimaryVersion"),
Content = new StringContent("{\n \"cryptoKeyVersionId\": \"\"\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}}/v1/:+name:updatePrimaryVersion");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cryptoKeyVersionId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name:updatePrimaryVersion"
payload := strings.NewReader("{\n \"cryptoKeyVersionId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+name:updatePrimaryVersion HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 30
{
"cryptoKeyVersionId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+name:updatePrimaryVersion")
.setHeader("content-type", "application/json")
.setBody("{\n \"cryptoKeyVersionId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name:updatePrimaryVersion"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cryptoKeyVersionId\": \"\"\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 \"cryptoKeyVersionId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name:updatePrimaryVersion")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+name:updatePrimaryVersion")
.header("content-type", "application/json")
.body("{\n \"cryptoKeyVersionId\": \"\"\n}")
.asString();
const data = JSON.stringify({
cryptoKeyVersionId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+name:updatePrimaryVersion');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:updatePrimaryVersion',
headers: {'content-type': 'application/json'},
data: {cryptoKeyVersionId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name:updatePrimaryVersion';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cryptoKeyVersionId":""}'
};
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}}/v1/:+name:updatePrimaryVersion',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cryptoKeyVersionId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cryptoKeyVersionId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name:updatePrimaryVersion")
.post(body)
.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/v1/:+name:updatePrimaryVersion',
headers: {
'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({cryptoKeyVersionId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+name:updatePrimaryVersion',
headers: {'content-type': 'application/json'},
body: {cryptoKeyVersionId: ''},
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}}/v1/:+name:updatePrimaryVersion');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cryptoKeyVersionId: ''
});
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}}/v1/:+name:updatePrimaryVersion',
headers: {'content-type': 'application/json'},
data: {cryptoKeyVersionId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name:updatePrimaryVersion';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cryptoKeyVersionId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cryptoKeyVersionId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name:updatePrimaryVersion"]
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}}/v1/:+name:updatePrimaryVersion" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cryptoKeyVersionId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name:updatePrimaryVersion",
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([
'cryptoKeyVersionId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+name:updatePrimaryVersion', [
'body' => '{
"cryptoKeyVersionId": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name:updatePrimaryVersion');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cryptoKeyVersionId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cryptoKeyVersionId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+name:updatePrimaryVersion');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name:updatePrimaryVersion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cryptoKeyVersionId": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name:updatePrimaryVersion' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cryptoKeyVersionId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cryptoKeyVersionId\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+name:updatePrimaryVersion", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name:updatePrimaryVersion"
payload = { "cryptoKeyVersionId": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name:updatePrimaryVersion"
payload <- "{\n \"cryptoKeyVersionId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name:updatePrimaryVersion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cryptoKeyVersionId\": \"\"\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/v1/:+name:updatePrimaryVersion') do |req|
req.body = "{\n \"cryptoKeyVersionId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name:updatePrimaryVersion";
let payload = json!({"cryptoKeyVersionId": ""});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+name:updatePrimaryVersion' \
--header 'content-type: application/json' \
--data '{
"cryptoKeyVersionId": ""
}'
echo '{
"cryptoKeyVersionId": ""
}' | \
http POST '{{baseUrl}}/v1/:+name:updatePrimaryVersion' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cryptoKeyVersionId": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+name:updatePrimaryVersion'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["cryptoKeyVersionId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name:updatePrimaryVersion")! 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
cloudkms.projects.locations.keyRings.importJobs.create
{{baseUrl}}/v1/:+parent/importJobs
QUERY PARAMS
parent
BODY json
{
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": {
"pem": ""
},
"state": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/importJobs");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:+parent/importJobs" {:content-type :json
:form-params {:attestation {:certChains {:caviumCerts []
:googleCardCerts []
:googlePartitionCerts []}
:content ""
:format ""}
:createTime ""
:expireEventTime ""
:expireTime ""
:generateTime ""
:importMethod ""
:name ""
:protectionLevel ""
:publicKey {:pem ""}
:state ""}})
require "http/client"
url = "{{baseUrl}}/v1/:+parent/importJobs"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\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}}/v1/:+parent/importJobs"),
Content = new StringContent("{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\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}}/v1/:+parent/importJobs");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/importJobs"
payload := strings.NewReader("{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/:+parent/importJobs HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 375
{
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": {
"pem": ""
},
"state": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:+parent/importJobs")
.setHeader("content-type", "application/json")
.setBody("{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/importJobs"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\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 \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/importJobs")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:+parent/importJobs")
.header("content-type", "application/json")
.body("{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}")
.asString();
const data = JSON.stringify({
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
expireEventTime: '',
expireTime: '',
generateTime: '',
importMethod: '',
name: '',
protectionLevel: '',
publicKey: {
pem: ''
},
state: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:+parent/importJobs');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/importJobs',
headers: {'content-type': 'application/json'},
data: {
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
expireEventTime: '',
expireTime: '',
generateTime: '',
importMethod: '',
name: '',
protectionLevel: '',
publicKey: {pem: ''},
state: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/importJobs';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","expireEventTime":"","expireTime":"","generateTime":"","importMethod":"","name":"","protectionLevel":"","publicKey":{"pem":""},"state":""}'
};
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}}/v1/:+parent/importJobs',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "expireEventTime": "",\n "expireTime": "",\n "generateTime": "",\n "importMethod": "",\n "name": "",\n "protectionLevel": "",\n "publicKey": {\n "pem": ""\n },\n "state": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/importJobs")
.post(body)
.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/v1/:+parent/importJobs',
headers: {
'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({
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
expireEventTime: '',
expireTime: '',
generateTime: '',
importMethod: '',
name: '',
protectionLevel: '',
publicKey: {pem: ''},
state: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:+parent/importJobs',
headers: {'content-type': 'application/json'},
body: {
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
expireEventTime: '',
expireTime: '',
generateTime: '',
importMethod: '',
name: '',
protectionLevel: '',
publicKey: {pem: ''},
state: ''
},
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}}/v1/:+parent/importJobs');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
attestation: {
certChains: {
caviumCerts: [],
googleCardCerts: [],
googlePartitionCerts: []
},
content: '',
format: ''
},
createTime: '',
expireEventTime: '',
expireTime: '',
generateTime: '',
importMethod: '',
name: '',
protectionLevel: '',
publicKey: {
pem: ''
},
state: ''
});
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}}/v1/:+parent/importJobs',
headers: {'content-type': 'application/json'},
data: {
attestation: {
certChains: {caviumCerts: [], googleCardCerts: [], googlePartitionCerts: []},
content: '',
format: ''
},
createTime: '',
expireEventTime: '',
expireTime: '',
generateTime: '',
importMethod: '',
name: '',
protectionLevel: '',
publicKey: {pem: ''},
state: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/importJobs';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attestation":{"certChains":{"caviumCerts":[],"googleCardCerts":[],"googlePartitionCerts":[]},"content":"","format":""},"createTime":"","expireEventTime":"","expireTime":"","generateTime":"","importMethod":"","name":"","protectionLevel":"","publicKey":{"pem":""},"state":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"attestation": @{ @"certChains": @{ @"caviumCerts": @[ ], @"googleCardCerts": @[ ], @"googlePartitionCerts": @[ ] }, @"content": @"", @"format": @"" },
@"createTime": @"",
@"expireEventTime": @"",
@"expireTime": @"",
@"generateTime": @"",
@"importMethod": @"",
@"name": @"",
@"protectionLevel": @"",
@"publicKey": @{ @"pem": @"" },
@"state": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/importJobs"]
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}}/v1/:+parent/importJobs" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/importJobs",
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([
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'expireEventTime' => '',
'expireTime' => '',
'generateTime' => '',
'importMethod' => '',
'name' => '',
'protectionLevel' => '',
'publicKey' => [
'pem' => ''
],
'state' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:+parent/importJobs', [
'body' => '{
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": {
"pem": ""
},
"state": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/importJobs');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'expireEventTime' => '',
'expireTime' => '',
'generateTime' => '',
'importMethod' => '',
'name' => '',
'protectionLevel' => '',
'publicKey' => [
'pem' => ''
],
'state' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'attestation' => [
'certChains' => [
'caviumCerts' => [
],
'googleCardCerts' => [
],
'googlePartitionCerts' => [
]
],
'content' => '',
'format' => ''
],
'createTime' => '',
'expireEventTime' => '',
'expireTime' => '',
'generateTime' => '',
'importMethod' => '',
'name' => '',
'protectionLevel' => '',
'publicKey' => [
'pem' => ''
],
'state' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:+parent/importJobs');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/importJobs' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": {
"pem": ""
},
"state": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/importJobs' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": {
"pem": ""
},
"state": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:+parent/importJobs", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/importJobs"
payload = {
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": { "pem": "" },
"state": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/importJobs"
payload <- "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/importJobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\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/v1/:+parent/importJobs') do |req|
req.body = "{\n \"attestation\": {\n \"certChains\": {\n \"caviumCerts\": [],\n \"googleCardCerts\": [],\n \"googlePartitionCerts\": []\n },\n \"content\": \"\",\n \"format\": \"\"\n },\n \"createTime\": \"\",\n \"expireEventTime\": \"\",\n \"expireTime\": \"\",\n \"generateTime\": \"\",\n \"importMethod\": \"\",\n \"name\": \"\",\n \"protectionLevel\": \"\",\n \"publicKey\": {\n \"pem\": \"\"\n },\n \"state\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/importJobs";
let payload = json!({
"attestation": json!({
"certChains": json!({
"caviumCerts": (),
"googleCardCerts": (),
"googlePartitionCerts": ()
}),
"content": "",
"format": ""
}),
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": json!({"pem": ""}),
"state": ""
});
let mut headers = reqwest::header::HeaderMap::new();
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}}/v1/:+parent/importJobs' \
--header 'content-type: application/json' \
--data '{
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": {
"pem": ""
},
"state": ""
}'
echo '{
"attestation": {
"certChains": {
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
},
"content": "",
"format": ""
},
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": {
"pem": ""
},
"state": ""
}' | \
http POST '{{baseUrl}}/v1/:+parent/importJobs' \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "attestation": {\n "certChains": {\n "caviumCerts": [],\n "googleCardCerts": [],\n "googlePartitionCerts": []\n },\n "content": "",\n "format": ""\n },\n "createTime": "",\n "expireEventTime": "",\n "expireTime": "",\n "generateTime": "",\n "importMethod": "",\n "name": "",\n "protectionLevel": "",\n "publicKey": {\n "pem": ""\n },\n "state": ""\n}' \
--output-document \
- '{{baseUrl}}/v1/:+parent/importJobs'
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"attestation": [
"certChains": [
"caviumCerts": [],
"googleCardCerts": [],
"googlePartitionCerts": []
],
"content": "",
"format": ""
],
"createTime": "",
"expireEventTime": "",
"expireTime": "",
"generateTime": "",
"importMethod": "",
"name": "",
"protectionLevel": "",
"publicKey": ["pem": ""],
"state": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/importJobs")! 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()
GET
cloudkms.projects.locations.keyRings.importJobs.get
{{baseUrl}}/v1/:+name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+name")
require "http/client"
url = "{{baseUrl}}/v1/:+name"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+name")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name';
const options = {method: 'GET'};
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}}/v1/:+name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+name',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+name');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+name'
http GET '{{baseUrl}}/v1/:+name'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+name'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
GET
cloudkms.projects.locations.keyRings.importJobs.list
{{baseUrl}}/v1/:+parent/importJobs
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/importJobs");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+parent/importJobs")
require "http/client"
url = "{{baseUrl}}/v1/:+parent/importJobs"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent/importJobs"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent/importJobs");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/importJobs"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+parent/importJobs HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+parent/importJobs")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/importJobs"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/importJobs")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+parent/importJobs")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+parent/importJobs');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/importJobs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/importJobs';
const options = {method: 'GET'};
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}}/v1/:+parent/importJobs',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/importJobs")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+parent/importJobs',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/importJobs'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+parent/importJobs');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/importJobs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/importJobs';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/importJobs"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+parent/importJobs" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/importJobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+parent/importJobs');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/importJobs');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+parent/importJobs');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/importJobs' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/importJobs' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+parent/importJobs")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/importJobs"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/importJobs"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/importJobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+parent/importJobs') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/importJobs";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+parent/importJobs'
http GET '{{baseUrl}}/v1/:+parent/importJobs'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+parent/importJobs'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/importJobs")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
GET
cloudkms.projects.locations.keyRings.list
{{baseUrl}}/v1/:+parent/keyRings
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent/keyRings");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+parent/keyRings")
require "http/client"
url = "{{baseUrl}}/v1/:+parent/keyRings"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent/keyRings"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent/keyRings");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent/keyRings"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+parent/keyRings HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+parent/keyRings")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent/keyRings"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyRings")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+parent/keyRings")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+parent/keyRings');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/keyRings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent/keyRings';
const options = {method: 'GET'};
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}}/v1/:+parent/keyRings',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent/keyRings")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+parent/keyRings',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/keyRings'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+parent/keyRings');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+parent/keyRings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent/keyRings';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent/keyRings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+parent/keyRings" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent/keyRings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+parent/keyRings');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent/keyRings');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+parent/keyRings');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent/keyRings' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent/keyRings' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+parent/keyRings")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent/keyRings"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent/keyRings"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent/keyRings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+parent/keyRings') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent/keyRings";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+parent/keyRings'
http GET '{{baseUrl}}/v1/:+parent/keyRings'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+parent/keyRings'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent/keyRings")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
GET
cloudkms.projects.locations.list
{{baseUrl}}/v1/:+name/locations
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+name/locations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+name/locations")
require "http/client"
url = "{{baseUrl}}/v1/:+name/locations"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+name/locations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+name/locations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+name/locations"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+name/locations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+name/locations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+name/locations"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+name/locations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+name/locations")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+name/locations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+name/locations';
const options = {method: 'GET'};
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}}/v1/:+name/locations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+name/locations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+name/locations',
headers: {}
};
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.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name/locations'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+name/locations');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:+name/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+name/locations';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+name/locations"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+name/locations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+name/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+name/locations');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+name/locations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+name/locations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+name/locations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+name/locations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+name/locations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+name/locations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+name/locations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+name/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+name/locations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+name/locations";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+name/locations'
http GET '{{baseUrl}}/v1/:+name/locations'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+name/locations'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+name/locations")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
GET
cloudkms.projects.showEffectiveAutokeyConfig
{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig")
require "http/client"
url = "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:+parent:showEffectiveAutokeyConfig HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig';
const options = {method: 'GET'};
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}}/v1/:+parent:showEffectiveAutokeyConfig',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:+parent:showEffectiveAutokeyConfig',
headers: {}
};
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.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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}}/v1/:+parent:showEffectiveAutokeyConfig" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:+parent:showEffectiveAutokeyConfig")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:+parent:showEffectiveAutokeyConfig') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig'
http GET '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:+parent:showEffectiveAutokeyConfig")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
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()