Pub/Sub Lite API
POST
pubsublite.admin.projects.locations.operations.cancel
{{baseUrl}}/v1/admin/:name:cancel
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/admin/:name:cancel");
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/admin/:name:cancel" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/v1/admin/:name:cancel"
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/admin/:name:cancel"),
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/admin/:name:cancel");
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/admin/:name:cancel"
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/admin/:name:cancel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/admin/:name:cancel")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name:cancel"))
.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/admin/:name:cancel")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/admin/:name:cancel")
.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/admin/:name:cancel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:name:cancel',
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/admin/:name:cancel';
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/admin/:name:cancel',
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/admin/:name:cancel")
.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/admin/:name:cancel',
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/admin/:name:cancel',
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/admin/:name:cancel');
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/admin/:name:cancel',
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/admin/:name:cancel';
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/admin/:name:cancel"]
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/admin/:name:cancel" 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/admin/:name:cancel",
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/admin/:name:cancel', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name:cancel');
$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/admin/:name:cancel');
$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/admin/:name:cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name:cancel' -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/admin/:name:cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name:cancel"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name:cancel"
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/admin/:name:cancel")
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/admin/:name:cancel') 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/admin/:name:cancel";
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/admin/:name:cancel \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/v1/admin/:name:cancel \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/v1/admin/:name:cancel
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/admin/:name:cancel")! 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
pubsublite.admin.projects.locations.operations.list
{{baseUrl}}/v1/admin/:name/operations
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/admin/:name/operations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:name/operations")
require "http/client"
url = "{{baseUrl}}/v1/admin/:name/operations"
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/admin/:name/operations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/admin/:name/operations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:name/operations"
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/admin/:name/operations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:name/operations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name/operations"))
.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/admin/:name/operations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/:name/operations")
.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/admin/:name/operations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/admin/:name/operations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:name/operations';
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/admin/:name/operations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:name/operations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/:name/operations',
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/admin/:name/operations'};
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/admin/:name/operations');
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/admin/:name/operations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:name/operations';
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/admin/:name/operations"]
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/admin/:name/operations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:name/operations",
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/admin/:name/operations');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name/operations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:name/operations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:name/operations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name/operations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:name/operations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name/operations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name/operations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:name/operations")
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/admin/:name/operations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:name/operations";
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/admin/:name/operations
http GET {{baseUrl}}/v1/admin/:name/operations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:name/operations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:name/operations")! 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
pubsublite.admin.projects.locations.reservations.create
{{baseUrl}}/v1/admin/:parent/reservations
QUERY PARAMS
parent
BODY json
{
"name": "",
"throughputCapacity": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/admin/:parent/reservations");
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 \"name\": \"\",\n \"throughputCapacity\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/admin/:parent/reservations" {:content-type :json
:form-params {:name ""
:throughputCapacity ""}})
require "http/client"
url = "{{baseUrl}}/v1/admin/:parent/reservations"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\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/admin/:parent/reservations"),
Content = new StringContent("{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\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/admin/:parent/reservations");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:parent/reservations"
payload := strings.NewReader("{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\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/admin/:parent/reservations HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 44
{
"name": "",
"throughputCapacity": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/admin/:parent/reservations")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:parent/reservations"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/reservations")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/admin/:parent/reservations")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}")
.asString();
const data = JSON.stringify({
name: '',
throughputCapacity: ''
});
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/admin/:parent/reservations');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:parent/reservations',
headers: {'content-type': 'application/json'},
data: {name: '', throughputCapacity: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:parent/reservations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","throughputCapacity":""}'
};
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/admin/:parent/reservations',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "throughputCapacity": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/reservations")
.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/admin/:parent/reservations',
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({name: '', throughputCapacity: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:parent/reservations',
headers: {'content-type': 'application/json'},
body: {name: '', throughputCapacity: ''},
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/admin/:parent/reservations');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
throughputCapacity: ''
});
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/admin/:parent/reservations',
headers: {'content-type': 'application/json'},
data: {name: '', throughputCapacity: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:parent/reservations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","throughputCapacity":""}'
};
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 = @{ @"name": @"",
@"throughputCapacity": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/admin/:parent/reservations"]
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/admin/:parent/reservations" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:parent/reservations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '',
'throughputCapacity' => ''
]),
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/admin/:parent/reservations', [
'body' => '{
"name": "",
"throughputCapacity": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:parent/reservations');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'throughputCapacity' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'throughputCapacity' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/admin/:parent/reservations');
$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/admin/:parent/reservations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"throughputCapacity": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:parent/reservations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"throughputCapacity": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/admin/:parent/reservations", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:parent/reservations"
payload = {
"name": "",
"throughputCapacity": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:parent/reservations"
payload <- "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\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/admin/:parent/reservations")
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 \"name\": \"\",\n \"throughputCapacity\": \"\"\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/admin/:parent/reservations') do |req|
req.body = "{\n \"name\": \"\",\n \"throughputCapacity\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:parent/reservations";
let payload = json!({
"name": "",
"throughputCapacity": ""
});
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/admin/:parent/reservations \
--header 'content-type: application/json' \
--data '{
"name": "",
"throughputCapacity": ""
}'
echo '{
"name": "",
"throughputCapacity": ""
}' | \
http POST {{baseUrl}}/v1/admin/:parent/reservations \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "throughputCapacity": ""\n}' \
--output-document \
- {{baseUrl}}/v1/admin/:parent/reservations
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"throughputCapacity": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:parent/reservations")! 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
pubsublite.admin.projects.locations.reservations.list
{{baseUrl}}/v1/admin/:parent/reservations
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/admin/:parent/reservations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:parent/reservations")
require "http/client"
url = "{{baseUrl}}/v1/admin/:parent/reservations"
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/admin/:parent/reservations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/admin/:parent/reservations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:parent/reservations"
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/admin/:parent/reservations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:parent/reservations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:parent/reservations"))
.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/admin/:parent/reservations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/:parent/reservations")
.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/admin/:parent/reservations');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/admin/:parent/reservations'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:parent/reservations';
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/admin/:parent/reservations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/reservations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/:parent/reservations',
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/admin/:parent/reservations'
};
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/admin/:parent/reservations');
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/admin/:parent/reservations'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:parent/reservations';
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/admin/:parent/reservations"]
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/admin/:parent/reservations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:parent/reservations",
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/admin/:parent/reservations');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:parent/reservations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:parent/reservations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:parent/reservations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:parent/reservations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:parent/reservations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:parent/reservations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:parent/reservations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:parent/reservations")
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/admin/:parent/reservations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:parent/reservations";
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/admin/:parent/reservations
http GET {{baseUrl}}/v1/admin/:parent/reservations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:parent/reservations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:parent/reservations")! 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
pubsublite.admin.projects.locations.reservations.topics.list
{{baseUrl}}/v1/admin/:name/topics
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/admin/:name/topics");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:name/topics")
require "http/client"
url = "{{baseUrl}}/v1/admin/:name/topics"
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/admin/:name/topics"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/admin/:name/topics");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:name/topics"
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/admin/:name/topics HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:name/topics")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name/topics"))
.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/admin/:name/topics")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/:name/topics")
.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/admin/:name/topics');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/admin/:name/topics'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:name/topics';
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/admin/:name/topics',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:name/topics")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/:name/topics',
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/admin/:name/topics'};
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/admin/:name/topics');
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/admin/:name/topics'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:name/topics';
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/admin/:name/topics"]
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/admin/:name/topics" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:name/topics",
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/admin/:name/topics');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name/topics');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:name/topics');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:name/topics' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name/topics' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:name/topics")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name/topics"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name/topics"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:name/topics")
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/admin/:name/topics') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:name/topics";
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/admin/:name/topics
http GET {{baseUrl}}/v1/admin/:name/topics
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:name/topics
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:name/topics")! 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
pubsublite.admin.projects.locations.subscriptions.create
{{baseUrl}}/v1/admin/:parent/subscriptions
QUERY PARAMS
parent
BODY json
{
"deliveryConfig": {
"deliveryRequirement": ""
},
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": {
"topic": ""
}
},
"name": "",
"topic": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/admin/:parent/subscriptions");
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 \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/admin/:parent/subscriptions" {:content-type :json
:form-params {:deliveryConfig {:deliveryRequirement ""}
:exportConfig {:currentState ""
:deadLetterTopic ""
:desiredState ""
:pubsubConfig {:topic ""}}
:name ""
:topic ""}})
require "http/client"
url = "{{baseUrl}}/v1/admin/:parent/subscriptions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\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/admin/:parent/subscriptions"),
Content = new StringContent("{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\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/admin/:parent/subscriptions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:parent/subscriptions"
payload := strings.NewReader("{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\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/admin/:parent/subscriptions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 234
{
"deliveryConfig": {
"deliveryRequirement": ""
},
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": {
"topic": ""
}
},
"name": "",
"topic": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/admin/:parent/subscriptions")
.setHeader("content-type", "application/json")
.setBody("{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:parent/subscriptions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\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 \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/subscriptions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/admin/:parent/subscriptions")
.header("content-type", "application/json")
.body("{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}")
.asString();
const data = JSON.stringify({
deliveryConfig: {
deliveryRequirement: ''
},
exportConfig: {
currentState: '',
deadLetterTopic: '',
desiredState: '',
pubsubConfig: {
topic: ''
}
},
name: '',
topic: ''
});
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/admin/:parent/subscriptions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:parent/subscriptions',
headers: {'content-type': 'application/json'},
data: {
deliveryConfig: {deliveryRequirement: ''},
exportConfig: {
currentState: '',
deadLetterTopic: '',
desiredState: '',
pubsubConfig: {topic: ''}
},
name: '',
topic: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:parent/subscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"deliveryConfig":{"deliveryRequirement":""},"exportConfig":{"currentState":"","deadLetterTopic":"","desiredState":"","pubsubConfig":{"topic":""}},"name":"","topic":""}'
};
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/admin/:parent/subscriptions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "deliveryConfig": {\n "deliveryRequirement": ""\n },\n "exportConfig": {\n "currentState": "",\n "deadLetterTopic": "",\n "desiredState": "",\n "pubsubConfig": {\n "topic": ""\n }\n },\n "name": "",\n "topic": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/subscriptions")
.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/admin/:parent/subscriptions',
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({
deliveryConfig: {deliveryRequirement: ''},
exportConfig: {
currentState: '',
deadLetterTopic: '',
desiredState: '',
pubsubConfig: {topic: ''}
},
name: '',
topic: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:parent/subscriptions',
headers: {'content-type': 'application/json'},
body: {
deliveryConfig: {deliveryRequirement: ''},
exportConfig: {
currentState: '',
deadLetterTopic: '',
desiredState: '',
pubsubConfig: {topic: ''}
},
name: '',
topic: ''
},
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/admin/:parent/subscriptions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
deliveryConfig: {
deliveryRequirement: ''
},
exportConfig: {
currentState: '',
deadLetterTopic: '',
desiredState: '',
pubsubConfig: {
topic: ''
}
},
name: '',
topic: ''
});
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/admin/:parent/subscriptions',
headers: {'content-type': 'application/json'},
data: {
deliveryConfig: {deliveryRequirement: ''},
exportConfig: {
currentState: '',
deadLetterTopic: '',
desiredState: '',
pubsubConfig: {topic: ''}
},
name: '',
topic: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:parent/subscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"deliveryConfig":{"deliveryRequirement":""},"exportConfig":{"currentState":"","deadLetterTopic":"","desiredState":"","pubsubConfig":{"topic":""}},"name":"","topic":""}'
};
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 = @{ @"deliveryConfig": @{ @"deliveryRequirement": @"" },
@"exportConfig": @{ @"currentState": @"", @"deadLetterTopic": @"", @"desiredState": @"", @"pubsubConfig": @{ @"topic": @"" } },
@"name": @"",
@"topic": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/admin/:parent/subscriptions"]
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/admin/:parent/subscriptions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:parent/subscriptions",
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([
'deliveryConfig' => [
'deliveryRequirement' => ''
],
'exportConfig' => [
'currentState' => '',
'deadLetterTopic' => '',
'desiredState' => '',
'pubsubConfig' => [
'topic' => ''
]
],
'name' => '',
'topic' => ''
]),
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/admin/:parent/subscriptions', [
'body' => '{
"deliveryConfig": {
"deliveryRequirement": ""
},
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": {
"topic": ""
}
},
"name": "",
"topic": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:parent/subscriptions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'deliveryConfig' => [
'deliveryRequirement' => ''
],
'exportConfig' => [
'currentState' => '',
'deadLetterTopic' => '',
'desiredState' => '',
'pubsubConfig' => [
'topic' => ''
]
],
'name' => '',
'topic' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'deliveryConfig' => [
'deliveryRequirement' => ''
],
'exportConfig' => [
'currentState' => '',
'deadLetterTopic' => '',
'desiredState' => '',
'pubsubConfig' => [
'topic' => ''
]
],
'name' => '',
'topic' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/admin/:parent/subscriptions');
$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/admin/:parent/subscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"deliveryConfig": {
"deliveryRequirement": ""
},
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": {
"topic": ""
}
},
"name": "",
"topic": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:parent/subscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"deliveryConfig": {
"deliveryRequirement": ""
},
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": {
"topic": ""
}
},
"name": "",
"topic": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/admin/:parent/subscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:parent/subscriptions"
payload = {
"deliveryConfig": { "deliveryRequirement": "" },
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": { "topic": "" }
},
"name": "",
"topic": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:parent/subscriptions"
payload <- "{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\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/admin/:parent/subscriptions")
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 \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\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/admin/:parent/subscriptions') do |req|
req.body = "{\n \"deliveryConfig\": {\n \"deliveryRequirement\": \"\"\n },\n \"exportConfig\": {\n \"currentState\": \"\",\n \"deadLetterTopic\": \"\",\n \"desiredState\": \"\",\n \"pubsubConfig\": {\n \"topic\": \"\"\n }\n },\n \"name\": \"\",\n \"topic\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:parent/subscriptions";
let payload = json!({
"deliveryConfig": json!({"deliveryRequirement": ""}),
"exportConfig": json!({
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": json!({"topic": ""})
}),
"name": "",
"topic": ""
});
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/admin/:parent/subscriptions \
--header 'content-type: application/json' \
--data '{
"deliveryConfig": {
"deliveryRequirement": ""
},
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": {
"topic": ""
}
},
"name": "",
"topic": ""
}'
echo '{
"deliveryConfig": {
"deliveryRequirement": ""
},
"exportConfig": {
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": {
"topic": ""
}
},
"name": "",
"topic": ""
}' | \
http POST {{baseUrl}}/v1/admin/:parent/subscriptions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "deliveryConfig": {\n "deliveryRequirement": ""\n },\n "exportConfig": {\n "currentState": "",\n "deadLetterTopic": "",\n "desiredState": "",\n "pubsubConfig": {\n "topic": ""\n }\n },\n "name": "",\n "topic": ""\n}' \
--output-document \
- {{baseUrl}}/v1/admin/:parent/subscriptions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"deliveryConfig": ["deliveryRequirement": ""],
"exportConfig": [
"currentState": "",
"deadLetterTopic": "",
"desiredState": "",
"pubsubConfig": ["topic": ""]
],
"name": "",
"topic": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:parent/subscriptions")! 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
pubsublite.admin.projects.locations.subscriptions.list
{{baseUrl}}/v1/admin/:parent/subscriptions
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/admin/:parent/subscriptions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:parent/subscriptions")
require "http/client"
url = "{{baseUrl}}/v1/admin/:parent/subscriptions"
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/admin/:parent/subscriptions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/admin/:parent/subscriptions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:parent/subscriptions"
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/admin/:parent/subscriptions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:parent/subscriptions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:parent/subscriptions"))
.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/admin/:parent/subscriptions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/:parent/subscriptions")
.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/admin/:parent/subscriptions');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/admin/:parent/subscriptions'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:parent/subscriptions';
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/admin/:parent/subscriptions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/subscriptions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/:parent/subscriptions',
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/admin/:parent/subscriptions'
};
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/admin/:parent/subscriptions');
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/admin/:parent/subscriptions'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:parent/subscriptions';
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/admin/:parent/subscriptions"]
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/admin/:parent/subscriptions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:parent/subscriptions",
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/admin/:parent/subscriptions');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:parent/subscriptions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:parent/subscriptions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:parent/subscriptions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:parent/subscriptions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:parent/subscriptions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:parent/subscriptions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:parent/subscriptions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:parent/subscriptions")
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/admin/:parent/subscriptions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:parent/subscriptions";
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/admin/:parent/subscriptions
http GET {{baseUrl}}/v1/admin/:parent/subscriptions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:parent/subscriptions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:parent/subscriptions")! 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
pubsublite.admin.projects.locations.subscriptions.seek
{{baseUrl}}/v1/admin/:name:seek
QUERY PARAMS
name
BODY json
{
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/admin/:name:seek");
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 \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/admin/:name:seek" {:content-type :json
:form-params {:namedTarget ""
:timeTarget {:eventTime ""
:publishTime ""}}})
require "http/client"
url = "{{baseUrl}}/v1/admin/:name:seek"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/admin/:name:seek"),
Content = new StringContent("{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/admin/:name:seek");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:name:seek"
payload := strings.NewReader("{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/admin/:name:seek HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 89
{
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/admin/:name:seek")
.setHeader("content-type", "application/json")
.setBody("{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name:seek"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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 \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/admin/:name:seek")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/admin/:name:seek")
.header("content-type", "application/json")
.body("{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
namedTarget: '',
timeTarget: {
eventTime: '',
publishTime: ''
}
});
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/admin/:name:seek');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:name:seek',
headers: {'content-type': 'application/json'},
data: {namedTarget: '', timeTarget: {eventTime: '', publishTime: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:name:seek';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"namedTarget":"","timeTarget":{"eventTime":"","publishTime":""}}'
};
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/admin/:name:seek',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "namedTarget": "",\n "timeTarget": {\n "eventTime": "",\n "publishTime": ""\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 \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:name:seek")
.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/admin/:name:seek',
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({namedTarget: '', timeTarget: {eventTime: '', publishTime: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:name:seek',
headers: {'content-type': 'application/json'},
body: {namedTarget: '', timeTarget: {eventTime: '', publishTime: ''}},
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/admin/:name:seek');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
namedTarget: '',
timeTarget: {
eventTime: '',
publishTime: ''
}
});
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/admin/:name:seek',
headers: {'content-type': 'application/json'},
data: {namedTarget: '', timeTarget: {eventTime: '', publishTime: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:name:seek';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"namedTarget":"","timeTarget":{"eventTime":"","publishTime":""}}'
};
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 = @{ @"namedTarget": @"",
@"timeTarget": @{ @"eventTime": @"", @"publishTime": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/admin/:name:seek"]
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/admin/:name:seek" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:name:seek",
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([
'namedTarget' => '',
'timeTarget' => [
'eventTime' => '',
'publishTime' => ''
]
]),
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/admin/:name:seek', [
'body' => '{
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name:seek');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'namedTarget' => '',
'timeTarget' => [
'eventTime' => '',
'publishTime' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'namedTarget' => '',
'timeTarget' => [
'eventTime' => '',
'publishTime' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/admin/:name:seek');
$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/admin/:name:seek' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name:seek' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/admin/:name:seek", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name:seek"
payload = {
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name:seek"
payload <- "{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/admin/:name:seek")
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 \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/admin/:name:seek') do |req|
req.body = "{\n \"namedTarget\": \"\",\n \"timeTarget\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/admin/:name:seek";
let payload = json!({
"namedTarget": "",
"timeTarget": json!({
"eventTime": "",
"publishTime": ""
})
});
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/admin/:name:seek \
--header 'content-type: application/json' \
--data '{
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}'
echo '{
"namedTarget": "",
"timeTarget": {
"eventTime": "",
"publishTime": ""
}
}' | \
http POST {{baseUrl}}/v1/admin/:name:seek \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "namedTarget": "",\n "timeTarget": {\n "eventTime": "",\n "publishTime": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v1/admin/:name:seek
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"namedTarget": "",
"timeTarget": [
"eventTime": "",
"publishTime": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:name:seek")! 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
pubsublite.admin.projects.locations.topics.create
{{baseUrl}}/v1/admin/:parent/topics
QUERY PARAMS
parent
BODY json
{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/admin/:parent/topics");
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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/admin/:parent/topics" {:content-type :json
:form-params {:name ""
:partitionConfig {:capacity {:publishMibPerSec 0
:subscribeMibPerSec 0}
:count ""
:scale 0}
:reservationConfig {:throughputReservation ""}
:retentionConfig {:perPartitionBytes ""
:period ""}}})
require "http/client"
url = "{{baseUrl}}/v1/admin/:parent/topics"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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/admin/:parent/topics"),
Content = new StringContent("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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/admin/:parent/topics");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:parent/topics"
payload := strings.NewReader("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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/admin/:parent/topics HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 296
{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/admin/:parent/topics")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:parent/topics"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/topics")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/admin/:parent/topics")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
name: '',
partitionConfig: {
capacity: {
publishMibPerSec: 0,
subscribeMibPerSec: 0
},
count: '',
scale: 0
},
reservationConfig: {
throughputReservation: ''
},
retentionConfig: {
perPartitionBytes: '',
period: ''
}
});
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/admin/:parent/topics');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:parent/topics',
headers: {'content-type': 'application/json'},
data: {
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:parent/topics';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","partitionConfig":{"capacity":{"publishMibPerSec":0,"subscribeMibPerSec":0},"count":"","scale":0},"reservationConfig":{"throughputReservation":""},"retentionConfig":{"perPartitionBytes":"","period":""}}'
};
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/admin/:parent/topics',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "partitionConfig": {\n "capacity": {\n "publishMibPerSec": 0,\n "subscribeMibPerSec": 0\n },\n "count": "",\n "scale": 0\n },\n "reservationConfig": {\n "throughputReservation": ""\n },\n "retentionConfig": {\n "perPartitionBytes": "",\n "period": ""\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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/topics")
.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/admin/:parent/topics',
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({
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/admin/:parent/topics',
headers: {'content-type': 'application/json'},
body: {
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
},
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/admin/:parent/topics');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
partitionConfig: {
capacity: {
publishMibPerSec: 0,
subscribeMibPerSec: 0
},
count: '',
scale: 0
},
reservationConfig: {
throughputReservation: ''
},
retentionConfig: {
perPartitionBytes: '',
period: ''
}
});
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/admin/:parent/topics',
headers: {'content-type': 'application/json'},
data: {
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:parent/topics';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","partitionConfig":{"capacity":{"publishMibPerSec":0,"subscribeMibPerSec":0},"count":"","scale":0},"reservationConfig":{"throughputReservation":""},"retentionConfig":{"perPartitionBytes":"","period":""}}'
};
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 = @{ @"name": @"",
@"partitionConfig": @{ @"capacity": @{ @"publishMibPerSec": @0, @"subscribeMibPerSec": @0 }, @"count": @"", @"scale": @0 },
@"reservationConfig": @{ @"throughputReservation": @"" },
@"retentionConfig": @{ @"perPartitionBytes": @"", @"period": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/admin/:parent/topics"]
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/admin/:parent/topics" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:parent/topics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '',
'partitionConfig' => [
'capacity' => [
'publishMibPerSec' => 0,
'subscribeMibPerSec' => 0
],
'count' => '',
'scale' => 0
],
'reservationConfig' => [
'throughputReservation' => ''
],
'retentionConfig' => [
'perPartitionBytes' => '',
'period' => ''
]
]),
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/admin/:parent/topics', [
'body' => '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:parent/topics');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'partitionConfig' => [
'capacity' => [
'publishMibPerSec' => 0,
'subscribeMibPerSec' => 0
],
'count' => '',
'scale' => 0
],
'reservationConfig' => [
'throughputReservation' => ''
],
'retentionConfig' => [
'perPartitionBytes' => '',
'period' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'partitionConfig' => [
'capacity' => [
'publishMibPerSec' => 0,
'subscribeMibPerSec' => 0
],
'count' => '',
'scale' => 0
],
'reservationConfig' => [
'throughputReservation' => ''
],
'retentionConfig' => [
'perPartitionBytes' => '',
'period' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/admin/:parent/topics');
$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/admin/:parent/topics' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:parent/topics' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/admin/:parent/topics", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:parent/topics"
payload = {
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": { "throughputReservation": "" },
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:parent/topics"
payload <- "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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/admin/:parent/topics")
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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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/admin/:parent/topics') do |req|
req.body = "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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/admin/:parent/topics";
let payload = json!({
"name": "",
"partitionConfig": json!({
"capacity": json!({
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
}),
"count": "",
"scale": 0
}),
"reservationConfig": json!({"throughputReservation": ""}),
"retentionConfig": json!({
"perPartitionBytes": "",
"period": ""
})
});
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/admin/:parent/topics \
--header 'content-type: application/json' \
--data '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}'
echo '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}' | \
http POST {{baseUrl}}/v1/admin/:parent/topics \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "partitionConfig": {\n "capacity": {\n "publishMibPerSec": 0,\n "subscribeMibPerSec": 0\n },\n "count": "",\n "scale": 0\n },\n "reservationConfig": {\n "throughputReservation": ""\n },\n "retentionConfig": {\n "perPartitionBytes": "",\n "period": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v1/admin/:parent/topics
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"partitionConfig": [
"capacity": [
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
],
"count": "",
"scale": 0
],
"reservationConfig": ["throughputReservation": ""],
"retentionConfig": [
"perPartitionBytes": "",
"period": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:parent/topics")! 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()
DELETE
pubsublite.admin.projects.locations.topics.delete
{{baseUrl}}/v1/admin/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/admin/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v1/admin/:name")
require "http/client"
url = "{{baseUrl}}/v1/admin/:name"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v1/admin/: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/admin/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:name"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v1/admin/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v1/admin/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name"))
.method("DELETE", 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/admin/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v1/admin/: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('DELETE', '{{baseUrl}}/v1/admin/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v1/admin/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:name';
const options = {method: 'DELETE'};
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/admin/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/: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: 'DELETE', url: '{{baseUrl}}/v1/admin/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v1/admin/: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: 'DELETE', url: '{{baseUrl}}/v1/admin/: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/admin/:name';
const options = {method: 'DELETE'};
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/admin/:name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
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/admin/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v1/admin/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v1/admin/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v1/admin/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:name";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v1/admin/:name
http DELETE {{baseUrl}}/v1/admin/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v1/admin/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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
pubsublite.admin.projects.locations.topics.get
{{baseUrl}}/v1/admin/: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/admin/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:name")
require "http/client"
url = "{{baseUrl}}/v1/admin/: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/admin/: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/admin/:name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/: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/admin/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/: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/admin/:name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/: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/admin/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/admin/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/: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/admin/:name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/: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/admin/: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/admin/: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/admin/: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/admin/: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/admin/: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/admin/: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/admin/:name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/: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/admin/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/: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/admin/:name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/: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/admin/:name
http GET {{baseUrl}}/v1/admin/:name
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/: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
pubsublite.admin.projects.locations.topics.getPartitions
{{baseUrl}}/v1/admin/:name/partitions
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/admin/:name/partitions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:name/partitions")
require "http/client"
url = "{{baseUrl}}/v1/admin/:name/partitions"
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/admin/:name/partitions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/admin/:name/partitions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:name/partitions"
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/admin/:name/partitions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:name/partitions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name/partitions"))
.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/admin/:name/partitions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/:name/partitions")
.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/admin/:name/partitions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/admin/:name/partitions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:name/partitions';
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/admin/:name/partitions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:name/partitions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/:name/partitions',
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/admin/:name/partitions'};
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/admin/:name/partitions');
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/admin/:name/partitions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:name/partitions';
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/admin/:name/partitions"]
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/admin/:name/partitions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:name/partitions",
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/admin/:name/partitions');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name/partitions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:name/partitions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:name/partitions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name/partitions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:name/partitions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name/partitions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name/partitions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:name/partitions")
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/admin/:name/partitions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:name/partitions";
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/admin/:name/partitions
http GET {{baseUrl}}/v1/admin/:name/partitions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:name/partitions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:name/partitions")! 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
pubsublite.admin.projects.locations.topics.list
{{baseUrl}}/v1/admin/:parent/topics
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/admin/:parent/topics");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:parent/topics")
require "http/client"
url = "{{baseUrl}}/v1/admin/:parent/topics"
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/admin/:parent/topics"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/admin/:parent/topics");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:parent/topics"
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/admin/:parent/topics HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:parent/topics")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:parent/topics"))
.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/admin/:parent/topics")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/:parent/topics")
.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/admin/:parent/topics');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/admin/:parent/topics'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:parent/topics';
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/admin/:parent/topics',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:parent/topics")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/:parent/topics',
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/admin/:parent/topics'};
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/admin/:parent/topics');
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/admin/:parent/topics'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:parent/topics';
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/admin/:parent/topics"]
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/admin/:parent/topics" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:parent/topics",
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/admin/:parent/topics');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:parent/topics');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:parent/topics');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:parent/topics' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:parent/topics' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:parent/topics")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:parent/topics"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:parent/topics"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:parent/topics")
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/admin/:parent/topics') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:parent/topics";
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/admin/:parent/topics
http GET {{baseUrl}}/v1/admin/:parent/topics
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:parent/topics
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:parent/topics")! 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()
PATCH
pubsublite.admin.projects.locations.topics.patch
{{baseUrl}}/v1/admin/:name
QUERY PARAMS
name
BODY json
{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/admin/: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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/v1/admin/:name" {:content-type :json
:form-params {:name ""
:partitionConfig {:capacity {:publishMibPerSec 0
:subscribeMibPerSec 0}
:count ""
:scale 0}
:reservationConfig {:throughputReservation ""}
:retentionConfig {:perPartitionBytes ""
:period ""}}})
require "http/client"
url = "{{baseUrl}}/v1/admin/:name"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\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/admin/:name"),
Content = new StringContent("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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/admin/:name");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:name"
payload := strings.NewReader("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\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/admin/:name HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 296
{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/v1/admin/:name")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/admin/:name")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/v1/admin/:name")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
name: '',
partitionConfig: {
capacity: {
publishMibPerSec: 0,
subscribeMibPerSec: 0
},
count: '',
scale: 0
},
reservationConfig: {
throughputReservation: ''
},
retentionConfig: {
perPartitionBytes: '',
period: ''
}
});
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/admin/:name');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v1/admin/:name',
headers: {'content-type': 'application/json'},
data: {
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:name';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"name":"","partitionConfig":{"capacity":{"publishMibPerSec":0,"subscribeMibPerSec":0},"count":"","scale":0},"reservationConfig":{"throughputReservation":""},"retentionConfig":{"perPartitionBytes":"","period":""}}'
};
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/admin/:name',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "partitionConfig": {\n "capacity": {\n "publishMibPerSec": 0,\n "subscribeMibPerSec": 0\n },\n "count": "",\n "scale": 0\n },\n "reservationConfig": {\n "throughputReservation": ""\n },\n "retentionConfig": {\n "perPartitionBytes": "",\n "period": ""\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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/: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/admin/: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({
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v1/admin/:name',
headers: {'content-type': 'application/json'},
body: {
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
},
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/admin/:name');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
partitionConfig: {
capacity: {
publishMibPerSec: 0,
subscribeMibPerSec: 0
},
count: '',
scale: 0
},
reservationConfig: {
throughputReservation: ''
},
retentionConfig: {
perPartitionBytes: '',
period: ''
}
});
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/admin/:name',
headers: {'content-type': 'application/json'},
data: {
name: '',
partitionConfig: {capacity: {publishMibPerSec: 0, subscribeMibPerSec: 0}, count: '', scale: 0},
reservationConfig: {throughputReservation: ''},
retentionConfig: {perPartitionBytes: '', period: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:name';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"name":"","partitionConfig":{"capacity":{"publishMibPerSec":0,"subscribeMibPerSec":0},"count":"","scale":0},"reservationConfig":{"throughputReservation":""},"retentionConfig":{"perPartitionBytes":"","period":""}}'
};
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 = @{ @"name": @"",
@"partitionConfig": @{ @"capacity": @{ @"publishMibPerSec": @0, @"subscribeMibPerSec": @0 }, @"count": @"", @"scale": @0 },
@"reservationConfig": @{ @"throughputReservation": @"" },
@"retentionConfig": @{ @"perPartitionBytes": @"", @"period": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/admin/: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/admin/:name" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/: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([
'name' => '',
'partitionConfig' => [
'capacity' => [
'publishMibPerSec' => 0,
'subscribeMibPerSec' => 0
],
'count' => '',
'scale' => 0
],
'reservationConfig' => [
'throughputReservation' => ''
],
'retentionConfig' => [
'perPartitionBytes' => '',
'period' => ''
]
]),
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/admin/:name', [
'body' => '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'partitionConfig' => [
'capacity' => [
'publishMibPerSec' => 0,
'subscribeMibPerSec' => 0
],
'count' => '',
'scale' => 0
],
'reservationConfig' => [
'throughputReservation' => ''
],
'retentionConfig' => [
'perPartitionBytes' => '',
'period' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'partitionConfig' => [
'capacity' => [
'publishMibPerSec' => 0,
'subscribeMibPerSec' => 0
],
'count' => '',
'scale' => 0
],
'reservationConfig' => [
'throughputReservation' => ''
],
'retentionConfig' => [
'perPartitionBytes' => '',
'period' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/admin/: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/admin/:name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/v1/admin/:name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name"
payload = {
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": { "throughputReservation": "" },
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name"
payload <- "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\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/admin/: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 \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\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.patch('/baseUrl/v1/admin/:name') do |req|
req.body = "{\n \"name\": \"\",\n \"partitionConfig\": {\n \"capacity\": {\n \"publishMibPerSec\": 0,\n \"subscribeMibPerSec\": 0\n },\n \"count\": \"\",\n \"scale\": 0\n },\n \"reservationConfig\": {\n \"throughputReservation\": \"\"\n },\n \"retentionConfig\": {\n \"perPartitionBytes\": \"\",\n \"period\": \"\"\n }\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/admin/:name";
let payload = json!({
"name": "",
"partitionConfig": json!({
"capacity": json!({
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
}),
"count": "",
"scale": 0
}),
"reservationConfig": json!({"throughputReservation": ""}),
"retentionConfig": json!({
"perPartitionBytes": "",
"period": ""
})
});
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/admin/:name \
--header 'content-type: application/json' \
--data '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}'
echo '{
"name": "",
"partitionConfig": {
"capacity": {
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
},
"count": "",
"scale": 0
},
"reservationConfig": {
"throughputReservation": ""
},
"retentionConfig": {
"perPartitionBytes": "",
"period": ""
}
}' | \
http PATCH {{baseUrl}}/v1/admin/:name \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "partitionConfig": {\n "capacity": {\n "publishMibPerSec": 0,\n "subscribeMibPerSec": 0\n },\n "count": "",\n "scale": 0\n },\n "reservationConfig": {\n "throughputReservation": ""\n },\n "retentionConfig": {\n "perPartitionBytes": "",\n "period": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v1/admin/:name
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"partitionConfig": [
"capacity": [
"publishMibPerSec": 0,
"subscribeMibPerSec": 0
],
"count": "",
"scale": 0
],
"reservationConfig": ["throughputReservation": ""],
"retentionConfig": [
"perPartitionBytes": "",
"period": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/: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()
GET
pubsublite.admin.projects.locations.topics.subscriptions.list
{{baseUrl}}/v1/admin/:name/subscriptions
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/admin/:name/subscriptions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/admin/:name/subscriptions")
require "http/client"
url = "{{baseUrl}}/v1/admin/:name/subscriptions"
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/admin/:name/subscriptions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/admin/:name/subscriptions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/admin/:name/subscriptions"
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/admin/:name/subscriptions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/admin/:name/subscriptions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/admin/:name/subscriptions"))
.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/admin/:name/subscriptions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/admin/:name/subscriptions")
.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/admin/:name/subscriptions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/admin/:name/subscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/admin/:name/subscriptions';
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/admin/:name/subscriptions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/admin/:name/subscriptions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/admin/:name/subscriptions',
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/admin/:name/subscriptions'};
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/admin/:name/subscriptions');
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/admin/:name/subscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/admin/:name/subscriptions';
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/admin/:name/subscriptions"]
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/admin/:name/subscriptions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/admin/:name/subscriptions",
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/admin/:name/subscriptions');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/admin/:name/subscriptions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/admin/:name/subscriptions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/admin/:name/subscriptions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/admin/:name/subscriptions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/admin/:name/subscriptions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/admin/:name/subscriptions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/admin/:name/subscriptions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/admin/:name/subscriptions")
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/admin/:name/subscriptions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/admin/:name/subscriptions";
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/admin/:name/subscriptions
http GET {{baseUrl}}/v1/admin/:name/subscriptions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/admin/:name/subscriptions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/admin/:name/subscriptions")! 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
pubsublite.cursor.projects.locations.subscriptions.commitCursor
{{baseUrl}}/v1/cursor/:subscription:commitCursor
QUERY PARAMS
subscription
BODY json
{
"cursor": {
"offset": ""
},
"partition": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/cursor/:subscription:commitCursor");
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 \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/cursor/:subscription:commitCursor" {:content-type :json
:form-params {:cursor {:offset ""}
:partition ""}})
require "http/client"
url = "{{baseUrl}}/v1/cursor/:subscription:commitCursor"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\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/cursor/:subscription:commitCursor"),
Content = new StringContent("{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\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/cursor/:subscription:commitCursor");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/cursor/:subscription:commitCursor"
payload := strings.NewReader("{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\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/cursor/:subscription:commitCursor HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 57
{
"cursor": {
"offset": ""
},
"partition": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/cursor/:subscription:commitCursor")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/cursor/:subscription:commitCursor"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\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 \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/cursor/:subscription:commitCursor")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/cursor/:subscription:commitCursor")
.header("content-type", "application/json")
.body("{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}")
.asString();
const data = JSON.stringify({
cursor: {
offset: ''
},
partition: ''
});
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/cursor/:subscription:commitCursor');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/cursor/:subscription:commitCursor',
headers: {'content-type': 'application/json'},
data: {cursor: {offset: ''}, partition: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/cursor/:subscription:commitCursor';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":{"offset":""},"partition":""}'
};
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/cursor/:subscription:commitCursor',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": {\n "offset": ""\n },\n "partition": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/cursor/:subscription:commitCursor")
.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/cursor/:subscription:commitCursor',
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({cursor: {offset: ''}, partition: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/cursor/:subscription:commitCursor',
headers: {'content-type': 'application/json'},
body: {cursor: {offset: ''}, partition: ''},
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/cursor/:subscription:commitCursor');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: {
offset: ''
},
partition: ''
});
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/cursor/:subscription:commitCursor',
headers: {'content-type': 'application/json'},
data: {cursor: {offset: ''}, partition: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/cursor/:subscription:commitCursor';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":{"offset":""},"partition":""}'
};
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 = @{ @"cursor": @{ @"offset": @"" },
@"partition": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/cursor/:subscription:commitCursor"]
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/cursor/:subscription:commitCursor" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/cursor/:subscription:commitCursor",
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([
'cursor' => [
'offset' => ''
],
'partition' => ''
]),
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/cursor/:subscription:commitCursor', [
'body' => '{
"cursor": {
"offset": ""
},
"partition": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/cursor/:subscription:commitCursor');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => [
'offset' => ''
],
'partition' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => [
'offset' => ''
],
'partition' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/cursor/:subscription:commitCursor');
$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/cursor/:subscription:commitCursor' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": {
"offset": ""
},
"partition": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/cursor/:subscription:commitCursor' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": {
"offset": ""
},
"partition": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/cursor/:subscription:commitCursor", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/cursor/:subscription:commitCursor"
payload = {
"cursor": { "offset": "" },
"partition": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/cursor/:subscription:commitCursor"
payload <- "{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\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/cursor/:subscription:commitCursor")
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 \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\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/cursor/:subscription:commitCursor') do |req|
req.body = "{\n \"cursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/cursor/:subscription:commitCursor";
let payload = json!({
"cursor": json!({"offset": ""}),
"partition": ""
});
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/cursor/:subscription:commitCursor \
--header 'content-type: application/json' \
--data '{
"cursor": {
"offset": ""
},
"partition": ""
}'
echo '{
"cursor": {
"offset": ""
},
"partition": ""
}' | \
http POST {{baseUrl}}/v1/cursor/:subscription:commitCursor \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": {\n "offset": ""\n },\n "partition": ""\n}' \
--output-document \
- {{baseUrl}}/v1/cursor/:subscription:commitCursor
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": ["offset": ""],
"partition": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/cursor/:subscription:commitCursor")! 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
pubsublite.cursor.projects.locations.subscriptions.cursors.list
{{baseUrl}}/v1/cursor/:parent/cursors
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/cursor/:parent/cursors");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/cursor/:parent/cursors")
require "http/client"
url = "{{baseUrl}}/v1/cursor/:parent/cursors"
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/cursor/:parent/cursors"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/cursor/:parent/cursors");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/cursor/:parent/cursors"
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/cursor/:parent/cursors HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/cursor/:parent/cursors")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/cursor/:parent/cursors"))
.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/cursor/:parent/cursors")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/cursor/:parent/cursors")
.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/cursor/:parent/cursors');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/cursor/:parent/cursors'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/cursor/:parent/cursors';
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/cursor/:parent/cursors',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/cursor/:parent/cursors")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/cursor/:parent/cursors',
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/cursor/:parent/cursors'};
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/cursor/:parent/cursors');
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/cursor/:parent/cursors'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/cursor/:parent/cursors';
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/cursor/:parent/cursors"]
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/cursor/:parent/cursors" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/cursor/:parent/cursors",
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/cursor/:parent/cursors');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/cursor/:parent/cursors');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/cursor/:parent/cursors');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/cursor/:parent/cursors' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/cursor/:parent/cursors' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/cursor/:parent/cursors")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/cursor/:parent/cursors"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/cursor/:parent/cursors"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/cursor/:parent/cursors")
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/cursor/:parent/cursors') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/cursor/:parent/cursors";
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/cursor/:parent/cursors
http GET {{baseUrl}}/v1/cursor/:parent/cursors
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/cursor/:parent/cursors
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/cursor/:parent/cursors")! 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
pubsublite.topicStats.projects.locations.topics.computeHeadCursor
{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor
QUERY PARAMS
topic
BODY json
{
"partition": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor");
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 \"partition\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor" {:content-type :json
:form-params {:partition ""}})
require "http/client"
url = "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"partition\": \"\"\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/topicStats/:topic:computeHeadCursor"),
Content = new StringContent("{\n \"partition\": \"\"\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/topicStats/:topic:computeHeadCursor");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"partition\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor"
payload := strings.NewReader("{\n \"partition\": \"\"\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/topicStats/:topic:computeHeadCursor HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 21
{
"partition": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor")
.setHeader("content-type", "application/json")
.setBody("{\n \"partition\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"partition\": \"\"\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 \"partition\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor")
.header("content-type", "application/json")
.body("{\n \"partition\": \"\"\n}")
.asString();
const data = JSON.stringify({
partition: ''
});
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/topicStats/:topic:computeHeadCursor');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor',
headers: {'content-type': 'application/json'},
data: {partition: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"partition":""}'
};
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/topicStats/:topic:computeHeadCursor',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "partition": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"partition\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor")
.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/topicStats/:topic:computeHeadCursor',
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({partition: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor',
headers: {'content-type': 'application/json'},
body: {partition: ''},
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/topicStats/:topic:computeHeadCursor');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
partition: ''
});
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/topicStats/:topic:computeHeadCursor',
headers: {'content-type': 'application/json'},
data: {partition: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"partition":""}'
};
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 = @{ @"partition": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor"]
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/topicStats/:topic:computeHeadCursor" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"partition\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor",
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([
'partition' => ''
]),
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/topicStats/:topic:computeHeadCursor', [
'body' => '{
"partition": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'partition' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'partition' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor');
$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/topicStats/:topic:computeHeadCursor' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"partition": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"partition": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"partition\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/topicStats/:topic:computeHeadCursor", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor"
payload = { "partition": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor"
payload <- "{\n \"partition\": \"\"\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/topicStats/:topic:computeHeadCursor")
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 \"partition\": \"\"\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/topicStats/:topic:computeHeadCursor') do |req|
req.body = "{\n \"partition\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor";
let payload = json!({"partition": ""});
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/topicStats/:topic:computeHeadCursor \
--header 'content-type: application/json' \
--data '{
"partition": ""
}'
echo '{
"partition": ""
}' | \
http POST {{baseUrl}}/v1/topicStats/:topic:computeHeadCursor \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "partition": ""\n}' \
--output-document \
- {{baseUrl}}/v1/topicStats/:topic:computeHeadCursor
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["partition": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/topicStats/:topic:computeHeadCursor")! 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
pubsublite.topicStats.projects.locations.topics.computeMessageStats
{{baseUrl}}/v1/topicStats/:topic:computeMessageStats
QUERY PARAMS
topic
BODY json
{
"endCursor": {
"offset": ""
},
"partition": "",
"startCursor": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats");
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 \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats" {:content-type :json
:form-params {:endCursor {:offset ""}
:partition ""
:startCursor {}}})
require "http/client"
url = "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\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/topicStats/:topic:computeMessageStats"),
Content = new StringContent("{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\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/topicStats/:topic:computeMessageStats");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats"
payload := strings.NewReader("{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\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/topicStats/:topic:computeMessageStats HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 81
{
"endCursor": {
"offset": ""
},
"partition": "",
"startCursor": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats")
.setHeader("content-type", "application/json")
.setBody("{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/topicStats/:topic:computeMessageStats"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\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 \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/topicStats/:topic:computeMessageStats")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/topicStats/:topic:computeMessageStats")
.header("content-type", "application/json")
.body("{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}")
.asString();
const data = JSON.stringify({
endCursor: {
offset: ''
},
partition: '',
startCursor: {}
});
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/topicStats/:topic:computeMessageStats');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/topicStats/:topic:computeMessageStats',
headers: {'content-type': 'application/json'},
data: {endCursor: {offset: ''}, partition: '', startCursor: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/topicStats/:topic:computeMessageStats';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"endCursor":{"offset":""},"partition":"","startCursor":{}}'
};
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/topicStats/:topic:computeMessageStats',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "endCursor": {\n "offset": ""\n },\n "partition": "",\n "startCursor": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/topicStats/:topic:computeMessageStats")
.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/topicStats/:topic:computeMessageStats',
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({endCursor: {offset: ''}, partition: '', startCursor: {}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/topicStats/:topic:computeMessageStats',
headers: {'content-type': 'application/json'},
body: {endCursor: {offset: ''}, partition: '', startCursor: {}},
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/topicStats/:topic:computeMessageStats');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
endCursor: {
offset: ''
},
partition: '',
startCursor: {}
});
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/topicStats/:topic:computeMessageStats',
headers: {'content-type': 'application/json'},
data: {endCursor: {offset: ''}, partition: '', startCursor: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/topicStats/:topic:computeMessageStats';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"endCursor":{"offset":""},"partition":"","startCursor":{}}'
};
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 = @{ @"endCursor": @{ @"offset": @"" },
@"partition": @"",
@"startCursor": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/topicStats/:topic:computeMessageStats"]
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/topicStats/:topic:computeMessageStats" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/topicStats/:topic:computeMessageStats",
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([
'endCursor' => [
'offset' => ''
],
'partition' => '',
'startCursor' => [
]
]),
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/topicStats/:topic:computeMessageStats', [
'body' => '{
"endCursor": {
"offset": ""
},
"partition": "",
"startCursor": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/topicStats/:topic:computeMessageStats');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'endCursor' => [
'offset' => ''
],
'partition' => '',
'startCursor' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'endCursor' => [
'offset' => ''
],
'partition' => '',
'startCursor' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/topicStats/:topic:computeMessageStats');
$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/topicStats/:topic:computeMessageStats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"endCursor": {
"offset": ""
},
"partition": "",
"startCursor": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/topicStats/:topic:computeMessageStats' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"endCursor": {
"offset": ""
},
"partition": "",
"startCursor": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/topicStats/:topic:computeMessageStats", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats"
payload = {
"endCursor": { "offset": "" },
"partition": "",
"startCursor": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats"
payload <- "{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\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/topicStats/:topic:computeMessageStats")
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 \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\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/topicStats/:topic:computeMessageStats') do |req|
req.body = "{\n \"endCursor\": {\n \"offset\": \"\"\n },\n \"partition\": \"\",\n \"startCursor\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats";
let payload = json!({
"endCursor": json!({"offset": ""}),
"partition": "",
"startCursor": 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/topicStats/:topic:computeMessageStats \
--header 'content-type: application/json' \
--data '{
"endCursor": {
"offset": ""
},
"partition": "",
"startCursor": {}
}'
echo '{
"endCursor": {
"offset": ""
},
"partition": "",
"startCursor": {}
}' | \
http POST {{baseUrl}}/v1/topicStats/:topic:computeMessageStats \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "endCursor": {\n "offset": ""\n },\n "partition": "",\n "startCursor": {}\n}' \
--output-document \
- {{baseUrl}}/v1/topicStats/:topic:computeMessageStats
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"endCursor": ["offset": ""],
"partition": "",
"startCursor": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/topicStats/:topic:computeMessageStats")! 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
pubsublite.topicStats.projects.locations.topics.computeTimeCursor
{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor
QUERY PARAMS
topic
BODY json
{
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor");
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 \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor" {:content-type :json
:form-params {:partition ""
:target {:eventTime ""
:publishTime ""}}})
require "http/client"
url = "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/topicStats/:topic:computeTimeCursor"),
Content = new StringContent("{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/topicStats/:topic:computeTimeCursor");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor"
payload := strings.NewReader("{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/topicStats/:topic:computeTimeCursor HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor")
.setHeader("content-type", "application/json")
.setBody("{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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 \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor")
.header("content-type", "application/json")
.body("{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
partition: '',
target: {
eventTime: '',
publishTime: ''
}
});
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/topicStats/:topic:computeTimeCursor');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor',
headers: {'content-type': 'application/json'},
data: {partition: '', target: {eventTime: '', publishTime: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"partition":"","target":{"eventTime":"","publishTime":""}}'
};
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/topicStats/:topic:computeTimeCursor',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "partition": "",\n "target": {\n "eventTime": "",\n "publishTime": ""\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 \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor")
.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/topicStats/:topic:computeTimeCursor',
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({partition: '', target: {eventTime: '', publishTime: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor',
headers: {'content-type': 'application/json'},
body: {partition: '', target: {eventTime: '', publishTime: ''}},
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/topicStats/:topic:computeTimeCursor');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
partition: '',
target: {
eventTime: '',
publishTime: ''
}
});
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/topicStats/:topic:computeTimeCursor',
headers: {'content-type': 'application/json'},
data: {partition: '', target: {eventTime: '', publishTime: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"partition":"","target":{"eventTime":"","publishTime":""}}'
};
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 = @{ @"partition": @"",
@"target": @{ @"eventTime": @"", @"publishTime": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor"]
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/topicStats/:topic:computeTimeCursor" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor",
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([
'partition' => '',
'target' => [
'eventTime' => '',
'publishTime' => ''
]
]),
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/topicStats/:topic:computeTimeCursor', [
'body' => '{
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'partition' => '',
'target' => [
'eventTime' => '',
'publishTime' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'partition' => '',
'target' => [
'eventTime' => '',
'publishTime' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor');
$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/topicStats/:topic:computeTimeCursor' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/topicStats/:topic:computeTimeCursor", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor"
payload = {
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor"
payload <- "{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/topicStats/:topic:computeTimeCursor")
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 \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/topicStats/:topic:computeTimeCursor') do |req|
req.body = "{\n \"partition\": \"\",\n \"target\": {\n \"eventTime\": \"\",\n \"publishTime\": \"\"\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/topicStats/:topic:computeTimeCursor";
let payload = json!({
"partition": "",
"target": json!({
"eventTime": "",
"publishTime": ""
})
});
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/topicStats/:topic:computeTimeCursor \
--header 'content-type: application/json' \
--data '{
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}'
echo '{
"partition": "",
"target": {
"eventTime": "",
"publishTime": ""
}
}' | \
http POST {{baseUrl}}/v1/topicStats/:topic:computeTimeCursor \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "partition": "",\n "target": {\n "eventTime": "",\n "publishTime": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v1/topicStats/:topic:computeTimeCursor
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"partition": "",
"target": [
"eventTime": "",
"publishTime": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/topicStats/:topic:computeTimeCursor")! 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()