Postman API
Postman APIv1.20.0
The Postman API allows you to programmatically access data stored in Postman account with ease. The easiest way to get started with the API is to click the fork button to fork this collection to your own workspace and use Postman to send requests. Overview 1. You need a valid API Key to send requests to the API endpoints. You can get your key from the integrations dashboard. 1. The API has an access rate limit applied to it. 1. The Postman API will only respond to secured communication done over HTTPS. HTTP requests will be sent a 301 redirect to corresponding HTTPS resources. 1. Response to…
- Endpoints
- 57 (23 GET, 17 POST, 9 PUT, 8 DELETE)
- Base URL
https://api.getpostman.com- Authentication
- Not specified in spec
- Spec format
- OpenAPI 3.0.3
- API version
- 1.20.0
- Provider
- getpostman.com
- Categories
- Developer Tools
- Last updated
Use this API in Bruno:
- Download the Bruno collection above and unzip it.
- In Bruno, choose Open Collection and select the unzipped folder.
- Set the
baseUrlvariable (for examplehttps://api.getpostman.com), then send requests.
POST
Create API Version
{{baseUrl}}/apis/:apiId/versions
BODY json
{
"version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": false,
"mock": false,
"monitor": false
},
"schema": false
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions");
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 \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/apis/:apiId/versions" {:content-type :json
:form-params {:version {:name ""
:source {:id ""
:relations {:documentation false
:mock false
:monitor false}
:schema false}}}})
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/apis/:apiId/versions"),
Content = new StringContent("{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions"
payload := strings.NewReader("{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/apis/:apiId/versions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 208
{
"version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": false,
"mock": false,
"monitor": false
},
"schema": false
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/apis/:apiId/versions")
.setHeader("content-type", "application/json")
.setBody("{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/apis/:apiId/versions")
.header("content-type", "application/json")
.body("{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}")
.asString();
const data = JSON.stringify({
version: {
name: '',
source: {
id: '',
relations: {
documentation: false,
mock: false,
monitor: false
},
schema: false
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/apis/:apiId/versions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions',
headers: {'content-type': 'application/json'},
data: {
version: {
name: '',
source: {
id: '',
relations: {documentation: false, mock: false, monitor: false},
schema: false
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"version":{"name":"","source":{"id":"","relations":{"documentation":false,"mock":false,"monitor":false},"schema":false}}}'
};
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}}/apis/:apiId/versions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "version": {\n "name": "",\n "source": {\n "id": "",\n "relations": {\n "documentation": false,\n "mock": false,\n "monitor": false\n },\n "schema": false\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions")
.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/apis/:apiId/versions',
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({
version: {
name: '',
source: {
id: '',
relations: {documentation: false, mock: false, monitor: false},
schema: false
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions',
headers: {'content-type': 'application/json'},
body: {
version: {
name: '',
source: {
id: '',
relations: {documentation: false, mock: false, monitor: false},
schema: false
}
}
},
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}}/apis/:apiId/versions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
version: {
name: '',
source: {
id: '',
relations: {
documentation: false,
mock: false,
monitor: false
},
schema: false
}
}
});
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}}/apis/:apiId/versions',
headers: {'content-type': 'application/json'},
data: {
version: {
name: '',
source: {
id: '',
relations: {documentation: false, mock: false, monitor: false},
schema: false
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"version":{"name":"","source":{"id":"","relations":{"documentation":false,"mock":false,"monitor":false},"schema":false}}}'
};
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 = @{ @"version": @{ @"name": @"", @"source": @{ @"id": @"", @"relations": @{ @"documentation": @NO, @"mock": @NO, @"monitor": @NO }, @"schema": @NO } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis/:apiId/versions"]
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}}/apis/:apiId/versions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions",
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([
'version' => [
'name' => '',
'source' => [
'id' => '',
'relations' => [
'documentation' => null,
'mock' => null,
'monitor' => null
],
'schema' => null
]
]
]),
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}}/apis/:apiId/versions', [
'body' => '{
"version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": false,
"mock": false,
"monitor": false
},
"schema": false
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'version' => [
'name' => '',
'source' => [
'id' => '',
'relations' => [
'documentation' => null,
'mock' => null,
'monitor' => null
],
'schema' => null
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'version' => [
'name' => '',
'source' => [
'id' => '',
'relations' => [
'documentation' => null,
'mock' => null,
'monitor' => null
],
'schema' => null
]
]
]));
$request->setRequestUrl('{{baseUrl}}/apis/:apiId/versions');
$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}}/apis/:apiId/versions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": false,
"mock": false,
"monitor": false
},
"schema": false
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": false,
"mock": false,
"monitor": false
},
"schema": false
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/apis/:apiId/versions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions"
payload = { "version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": False,
"mock": False,
"monitor": False
},
"schema": False
}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions"
payload <- "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions")
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 \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/apis/:apiId/versions') do |req|
req.body = "{\n \"version\": {\n \"name\": \"\",\n \"source\": {\n \"id\": \"\",\n \"relations\": {\n \"documentation\": false,\n \"mock\": false,\n \"monitor\": false\n },\n \"schema\": false\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions";
let payload = json!({"version": json!({
"name": "",
"source": json!({
"id": "",
"relations": json!({
"documentation": false,
"mock": false,
"monitor": false
}),
"schema": false
})
})});
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}}/apis/:apiId/versions \
--header 'content-type: application/json' \
--data '{
"version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": false,
"mock": false,
"monitor": false
},
"schema": false
}
}
}'
echo '{
"version": {
"name": "",
"source": {
"id": "",
"relations": {
"documentation": false,
"mock": false,
"monitor": false
},
"schema": false
}
}
}' | \
http POST {{baseUrl}}/apis/:apiId/versions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "version": {\n "name": "",\n "source": {\n "id": "",\n "relations": {\n "documentation": false,\n "mock": false,\n "monitor": false\n },\n "schema": false\n }\n }\n}' \
--output-document \
- {{baseUrl}}/apis/:apiId/versions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["version": [
"name": "",
"source": [
"id": "",
"relations": [
"documentation": false,
"mock": false,
"monitor": false
],
"schema": false
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"version": {
"api": "2b95d07c-8379-4bd1-924f-e7e1af185284",
"id": "d71cf403-c549-4c7c-9dc6-a6a105acf67c",
"name": "1.0"
}
}
POST
Create API
{{baseUrl}}/apis
BODY json
{
"api": {
"description": "",
"name": "",
"summary": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis");
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 \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/apis" {:content-type :json
:form-params {:api {:description ""
:name ""
:summary ""}}})
require "http/client"
url = "{{baseUrl}}/apis"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\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}}/apis"),
Content = new StringContent("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\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}}/apis");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis"
payload := strings.NewReader("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\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/apis HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 75
{
"api": {
"description": "",
"name": "",
"summary": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/apis")
.setHeader("content-type", "application/json")
.setBody("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\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 \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/apis")
.header("content-type", "application/json")
.body("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
api: {
description: '',
name: '',
summary: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/apis');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/apis',
headers: {'content-type': 'application/json'},
data: {api: {description: '', name: '', summary: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"api":{"description":"","name":"","summary":""}}'
};
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}}/apis',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "api": {\n "description": "",\n "name": "",\n "summary": ""\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 \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis")
.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/apis',
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({api: {description: '', name: '', summary: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/apis',
headers: {'content-type': 'application/json'},
body: {api: {description: '', name: '', summary: ''}},
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}}/apis');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
api: {
description: '',
name: '',
summary: ''
}
});
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}}/apis',
headers: {'content-type': 'application/json'},
data: {api: {description: '', name: '', summary: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"api":{"description":"","name":"","summary":""}}'
};
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 = @{ @"api": @{ @"description": @"", @"name": @"", @"summary": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis"]
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}}/apis" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis",
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([
'api' => [
'description' => '',
'name' => '',
'summary' => ''
]
]),
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}}/apis', [
'body' => '{
"api": {
"description": "",
"name": "",
"summary": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'api' => [
'description' => '',
'name' => '',
'summary' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'api' => [
'description' => '',
'name' => '',
'summary' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/apis');
$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}}/apis' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"api": {
"description": "",
"name": "",
"summary": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"api": {
"description": "",
"name": "",
"summary": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/apis", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis"
payload = { "api": {
"description": "",
"name": "",
"summary": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis"
payload <- "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\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}}/apis")
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 \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\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/apis') do |req|
req.body = "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\",\n \"summary\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis";
let payload = json!({"api": json!({
"description": "",
"name": "",
"summary": ""
})});
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}}/apis \
--header 'content-type: application/json' \
--data '{
"api": {
"description": "",
"name": "",
"summary": ""
}
}'
echo '{
"api": {
"description": "",
"name": "",
"summary": ""
}
}' | \
http POST {{baseUrl}}/apis \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "api": {\n "description": "",\n "name": "",\n "summary": ""\n }\n}' \
--output-document \
- {{baseUrl}}/apis
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["api": [
"description": "",
"name": "",
"summary": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"api": {
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"description": "This is supposed to handle markdown *descriptions*.",
"id": "387c2863-6ee3-4a56-8210-225f774edade",
"name": "Sync API",
"summary": "This is a summary",
"updatedAt": "2019-02-12 19:34:49"
}
}
POST
Create Schema
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas
BODY json
{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas");
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 \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas" {:content-type :json
:form-params {:schema {:language ""
:schema ""
:type ""}}})
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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}}/apis/:apiId/versions/:apiVersionId/schemas"),
Content = new StringContent("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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}}/apis/:apiId/versions/:apiVersionId/schemas");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas"
payload := strings.NewReader("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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/apis/:apiId/versions/:apiVersionId/schemas HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 74
{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas")
.setHeader("content-type", "application/json")
.setBody("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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 \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas")
.header("content-type", "application/json")
.body("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
schema: {
language: '',
schema: '',
type: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas',
headers: {'content-type': 'application/json'},
data: {schema: {language: '', schema: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"schema":{"language":"","schema":"","type":""}}'
};
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}}/apis/:apiId/versions/:apiVersionId/schemas',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "schema": {\n "language": "",\n "schema": "",\n "type": ""\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 \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas")
.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/apis/:apiId/versions/:apiVersionId/schemas',
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({schema: {language: '', schema: '', type: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas',
headers: {'content-type': 'application/json'},
body: {schema: {language: '', schema: '', type: ''}},
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}}/apis/:apiId/versions/:apiVersionId/schemas');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
schema: {
language: '',
schema: '',
type: ''
}
});
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}}/apis/:apiId/versions/:apiVersionId/schemas',
headers: {'content-type': 'application/json'},
data: {schema: {language: '', schema: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"schema":{"language":"","schema":"","type":""}}'
};
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 = @{ @"schema": @{ @"language": @"", @"schema": @"", @"type": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas"]
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}}/apis/:apiId/versions/:apiVersionId/schemas" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas",
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([
'schema' => [
'language' => '',
'schema' => '',
'type' => ''
]
]),
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}}/apis/:apiId/versions/:apiVersionId/schemas', [
'body' => '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'schema' => [
'language' => '',
'schema' => '',
'type' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'schema' => [
'language' => '',
'schema' => '',
'type' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas');
$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}}/apis/:apiId/versions/:apiVersionId/schemas' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/apis/:apiId/versions/:apiVersionId/schemas", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas"
payload = { "schema": {
"language": "",
"schema": "",
"type": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas"
payload <- "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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}}/apis/:apiId/versions/:apiVersionId/schemas")
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 \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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/apis/:apiId/versions/:apiVersionId/schemas') do |req|
req.body = "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas";
let payload = json!({"schema": json!({
"language": "",
"schema": "",
"type": ""
})});
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}}/apis/:apiId/versions/:apiVersionId/schemas \
--header 'content-type: application/json' \
--data '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}'
echo '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}' | \
http POST {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "schema": {\n "language": "",\n "schema": "",\n "type": ""\n }\n}' \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["schema": [
"language": "",
"schema": "",
"type": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"schema": {
"apiVersion": "ad810c39-df60-434e-a76f-a2192cd8d81f",
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"id": "e3b3a0b7-34d5-4fc5-83e0-118bd9e8c822",
"language": "yaml",
"type": "openapi3",
"updateBy": "5665",
"updatedAt": "2019-02-12 19:34:49"
}
}
POST
Create collection from schema
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections
BODY json
{
"name": "",
"relations": [
{
"type": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections");
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 \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections" {:content-type :json
:form-params {:name ""
:relations [{:type ""}]}})
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections"),
Content = new StringContent("{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections"
payload := strings.NewReader("{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 67
{
"name": "",
"relations": [
{
"type": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
name: '',
relations: [
{
type: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections',
headers: {'content-type': 'application/json'},
data: {name: '', relations: [{type: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","relations":[{"type":""}]}'
};
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "relations": [\n {\n "type": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections")
.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/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections',
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: '', relations: [{type: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections',
headers: {'content-type': 'application/json'},
body: {name: '', relations: [{type: ''}]},
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
relations: [
{
type: ''
}
]
});
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections',
headers: {'content-type': 'application/json'},
data: {name: '', relations: [{type: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","relations":[{"type":""}]}'
};
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": @"",
@"relations": @[ @{ @"type": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections"]
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections",
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' => '',
'relations' => [
[
'type' => ''
]
]
]),
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections', [
'body' => '{
"name": "",
"relations": [
{
"type": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'relations' => [
[
'type' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'relations' => [
[
'type' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections');
$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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"relations": [
{
"type": ""
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"relations": [
{
"type": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections"
payload = {
"name": "",
"relations": [{ "type": "" }]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections"
payload <- "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections")
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 \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections') do |req|
req.body = "{\n \"name\": \"\",\n \"relations\": [\n {\n \"type\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections";
let payload = json!({
"name": "",
"relations": (json!({"type": ""}))
});
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections \
--header 'content-type: application/json' \
--data '{
"name": "",
"relations": [
{
"type": ""
}
]
}'
echo '{
"name": "",
"relations": [
{
"type": ""
}
]
}' | \
http POST {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "relations": [\n {\n "type": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"relations": [["type": ""]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId/collections")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collection": {
"id": "e6b0d46a-8722-4f42-ab86-f5f473187ddf",
"uid": "112098-e6b0d46a-8722-4f42-ab86-f5f473187ddf"
},
"relations": [
{
"id": "4b40f06a-5a6a-448f-bfcd-a6dbcb68da22",
"type": "contracttest"
}
]
}
POST
Create relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations
BODY json
{
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations");
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 \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations" {:content-type :json
:form-params {:contracttest []
:documentation []
:mock []
:testsuite []}})
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\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}}/apis/:apiId/versions/:apiVersionId/relations"),
Content = new StringContent("{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\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}}/apis/:apiId/versions/:apiVersionId/relations");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
payload := strings.NewReader("{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\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/apis/:apiId/versions/:apiVersionId/relations HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 80
{
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
.setHeader("content-type", "application/json")
.setBody("{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\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 \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
.header("content-type", "application/json")
.body("{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}")
.asString();
const data = JSON.stringify({
contracttest: [],
documentation: [],
mock: [],
testsuite: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations',
headers: {'content-type': 'application/json'},
data: {contracttest: [], documentation: [], mock: [], testsuite: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contracttest":[],"documentation":[],"mock":[],"testsuite":[]}'
};
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}}/apis/:apiId/versions/:apiVersionId/relations',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "contracttest": [],\n "documentation": [],\n "mock": [],\n "testsuite": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
.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/apis/:apiId/versions/:apiVersionId/relations',
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({contracttest: [], documentation: [], mock: [], testsuite: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations',
headers: {'content-type': 'application/json'},
body: {contracttest: [], documentation: [], mock: [], testsuite: []},
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}}/apis/:apiId/versions/:apiVersionId/relations');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
contracttest: [],
documentation: [],
mock: [],
testsuite: []
});
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}}/apis/:apiId/versions/:apiVersionId/relations',
headers: {'content-type': 'application/json'},
data: {contracttest: [], documentation: [], mock: [], testsuite: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contracttest":[],"documentation":[],"mock":[],"testsuite":[]}'
};
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 = @{ @"contracttest": @[ ],
@"documentation": @[ ],
@"mock": @[ ],
@"testsuite": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"]
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}}/apis/:apiId/versions/:apiVersionId/relations" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations",
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([
'contracttest' => [
],
'documentation' => [
],
'mock' => [
],
'testsuite' => [
]
]),
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}}/apis/:apiId/versions/:apiVersionId/relations', [
'body' => '{
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'contracttest' => [
],
'documentation' => [
],
'mock' => [
],
'testsuite' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'contracttest' => [
],
'documentation' => [
],
'mock' => [
],
'testsuite' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations');
$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}}/apis/:apiId/versions/:apiVersionId/relations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/apis/:apiId/versions/:apiVersionId/relations", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
payload = {
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
payload <- "{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\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}}/apis/:apiId/versions/:apiVersionId/relations")
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 \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\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/apis/:apiId/versions/:apiVersionId/relations') do |req|
req.body = "{\n \"contracttest\": [],\n \"documentation\": [],\n \"mock\": [],\n \"testsuite\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations";
let payload = json!({
"contracttest": (),
"documentation": (),
"mock": (),
"testsuite": ()
});
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}}/apis/:apiId/versions/:apiVersionId/relations \
--header 'content-type: application/json' \
--data '{
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}'
echo '{
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
}' | \
http POST {{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "contracttest": [],\n "documentation": [],\n "mock": [],\n "testsuite": []\n}' \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"contracttest": [],
"documentation": [],
"mock": [],
"testsuite": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"contracttest": [
"5bcece87-ca4b-4e75-a967-2a6845626164"
],
"documentation": [
"2084eba6-a17b-4751-8f03-ea60f30ba19c"
],
"testsuite": [
"e525fa71-035e-4620-acda-ce878524f1e7",
"17a974b2-ce79-4b95-9d3f-217d6ff7e979"
]
}
DELETE
Delete an API Version
{{baseUrl}}/apis/:apiId/versions/:apiVersionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
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}}/apis/:apiId/versions/:apiVersionId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
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/apis/:apiId/versions/:apiVersionId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId"))
.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}}/apis/:apiId/versions/:apiVersionId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.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}}/apis/:apiId/versions/:apiVersionId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId';
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}}/apis/:apiId/versions/:apiVersionId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId',
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}}/apis/:apiId/versions/:apiVersionId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
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}}/apis/:apiId/versions/:apiVersionId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId';
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}}/apis/:apiId/versions/:apiVersionId"]
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}}/apis/:apiId/versions/:apiVersionId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId",
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}}/apis/:apiId/versions/:apiVersionId');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/apis/:apiId/versions/:apiVersionId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
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/apis/:apiId/versions/:apiVersionId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId";
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}}/apis/:apiId/versions/:apiVersionId
http DELETE {{baseUrl}}/apis/:apiId/versions/:apiVersionId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"version": {
"id": "03c17f53-7e2e-427d-b55a-006b244f29ff"
}
}
DELETE
Delete an API
{{baseUrl}}/apis/:apiId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/apis/:apiId")
require "http/client"
url = "{{baseUrl}}/apis/:apiId"
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}}/apis/:apiId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId"
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/apis/:apiId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/apis/:apiId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId"))
.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}}/apis/:apiId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/apis/:apiId")
.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}}/apis/:apiId');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/apis/:apiId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId';
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}}/apis/:apiId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId',
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}}/apis/:apiId'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/apis/:apiId');
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}}/apis/:apiId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId';
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}}/apis/:apiId"]
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}}/apis/:apiId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId",
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}}/apis/:apiId');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/apis/:apiId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId")
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/apis/:apiId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId";
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}}/apis/:apiId
http DELETE {{baseUrl}}/apis/:apiId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/apis/:apiId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"api": {
"id": "387c2863-6ee3-4a56-8210-225f774edade"
}
}
GET
Get All API Versions
{{baseUrl}}/apis/:apiId/versions
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions"
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}}/apis/:apiId/versions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions"
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/apis/:apiId/versions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions"))
.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}}/apis/:apiId/versions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions")
.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}}/apis/:apiId/versions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/apis/:apiId/versions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions';
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}}/apis/:apiId/versions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions',
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}}/apis/:apiId/versions'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions');
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}}/apis/:apiId/versions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions';
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}}/apis/:apiId/versions"]
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}}/apis/:apiId/versions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions",
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}}/apis/:apiId/versions');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions")
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/apis/:apiId/versions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions";
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}}/apis/:apiId/versions
http GET {{baseUrl}}/apis/:apiId/versions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"versions": [
{
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"description": "Description",
"id": "024660a6-c837-46ca-91d8-7e8dd7c669de",
"name": "0.1",
"summary": "Summary",
"updatedAt": "2019-02-12 19:34:49"
},
{
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"description": "Description",
"id": "00932d3b-20f1-454f-a77e-38b4023163ea",
"name": "0.2",
"summary": "Summary",
"updatedAt": "2019-02-12 19:34:49"
}
]
}
GET
Get Schema
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
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/apis/:apiId/versions/:apiVersionId/schemas/:schemaId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"))
.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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId';
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId',
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId';
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"]
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId",
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
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/apis/:apiId/versions/:apiVersionId/schemas/:schemaId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId";
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"schema": {
"apiVersion": "ad810c39-df60-434e-a76f-a2192cd8d81f",
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"id": "e3b3a0b7-34d5-4fc5-83e0-118bd9e8c822",
"language": "yaml",
"type": "openapi3",
"updateBy": "5665",
"updatedAt": "2019-02-12 19:34:49"
}
}
GET
Get all APIs
{{baseUrl}}/apis
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis")
require "http/client"
url = "{{baseUrl}}/apis"
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}}/apis"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis"
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/apis HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis"))
.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}}/apis")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis")
.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}}/apis');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/apis'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis';
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}}/apis',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis',
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}}/apis'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis');
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}}/apis'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis';
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}}/apis"]
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}}/apis" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis",
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}}/apis');
echo $response->getBody();
setUrl('{{baseUrl}}/apis');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis")
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/apis') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis";
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}}/apis
http GET {{baseUrl}}/apis
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis")! 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
Get an API Version
{{baseUrl}}/apis/:apiId/versions/:apiVersionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
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}}/apis/:apiId/versions/:apiVersionId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
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/apis/:apiId/versions/:apiVersionId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId"))
.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}}/apis/:apiId/versions/:apiVersionId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.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}}/apis/:apiId/versions/:apiVersionId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId';
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}}/apis/:apiId/versions/:apiVersionId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId',
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}}/apis/:apiId/versions/:apiVersionId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
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}}/apis/:apiId/versions/:apiVersionId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId';
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}}/apis/:apiId/versions/:apiVersionId"]
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}}/apis/:apiId/versions/:apiVersionId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId",
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}}/apis/:apiId/versions/:apiVersionId');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
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/apis/:apiId/versions/:apiVersionId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId";
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}}/apis/:apiId/versions/:apiVersionId
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"version": {
"api": "06e41ca3-8bea-4bc5-a726-70338b9f1940",
"createdAt": "2019-07-21T16:31:15.000Z",
"createdBy": "5665",
"id": "03c17f53-7e2e-427d-b55a-006b244f29ff",
"name": "0.1",
"schema": [
"3484cd1e-e00d-4c39-aea4-539663afe898"
],
"updatedAt": "2019-07-21T16:31:15.000Z",
"updatedBy": "5665"
}
}
GET
Get contract test relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest"
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}}/apis/:apiId/versions/:apiVersionId/contracttest"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest"
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/apis/:apiId/versions/:apiVersionId/contracttest HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest"))
.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}}/apis/:apiId/versions/:apiVersionId/contracttest")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest")
.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}}/apis/:apiId/versions/:apiVersionId/contracttest');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest';
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}}/apis/:apiId/versions/:apiVersionId/contracttest',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/contracttest',
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}}/apis/:apiId/versions/:apiVersionId/contracttest'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest');
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}}/apis/:apiId/versions/:apiVersionId/contracttest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest';
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}}/apis/:apiId/versions/:apiVersionId/contracttest"]
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}}/apis/:apiId/versions/:apiVersionId/contracttest" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest",
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}}/apis/:apiId/versions/:apiVersionId/contracttest');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/contracttest")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest")
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/apis/:apiId/versions/:apiVersionId/contracttest') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest";
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}}/apis/:apiId/versions/:apiVersionId/contracttest
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/contracttest")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"contracttest": [
{
"collectionId": "7732157-a8bcd149-2b01-4b4c-8c14-c7d05be77745",
"id": "2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
},
{
"collectionId": "7332157-a8bcd143-2b01-4b12-8c14-c7d05be77725",
"id": "521b0486-ab91-4d3a-9189-43c9380a0533",
"name": "C1",
"updatedAt": "2019-08-29T11:40:39.000Z"
}
]
}
GET
Get documentation relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation"
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}}/apis/:apiId/versions/:apiVersionId/documentation"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation"
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/apis/:apiId/versions/:apiVersionId/documentation HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation"))
.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}}/apis/:apiId/versions/:apiVersionId/documentation")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation")
.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}}/apis/:apiId/versions/:apiVersionId/documentation');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation';
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}}/apis/:apiId/versions/:apiVersionId/documentation',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/documentation',
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}}/apis/:apiId/versions/:apiVersionId/documentation'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation');
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}}/apis/:apiId/versions/:apiVersionId/documentation'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation';
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}}/apis/:apiId/versions/:apiVersionId/documentation"]
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}}/apis/:apiId/versions/:apiVersionId/documentation" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation",
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}}/apis/:apiId/versions/:apiVersionId/documentation');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/documentation")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation")
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/apis/:apiId/versions/:apiVersionId/documentation') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation";
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}}/apis/:apiId/versions/:apiVersionId/documentation
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/documentation")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"documentation": [
{
"collectionId": "7732157-a8bcd149-2b01-4b4c-8c14-c7d05be77745",
"id": "2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
},
{
"collectionId": "7332157-a8bcd143-2b01-4b12-8c14-c7d05be77725",
"id": "521b0486-ab91-4d3a-9189-43c9380a0533",
"name": "C1",
"updatedAt": "2019-08-29T11:40:39.000Z"
}
]
}
GET
Get environment relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment"
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}}/apis/:apiId/versions/:apiVersionId/environment"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment"
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/apis/:apiId/versions/:apiVersionId/environment HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment"))
.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}}/apis/:apiId/versions/:apiVersionId/environment")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment")
.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}}/apis/:apiId/versions/:apiVersionId/environment');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment';
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}}/apis/:apiId/versions/:apiVersionId/environment',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/environment',
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}}/apis/:apiId/versions/:apiVersionId/environment'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment');
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}}/apis/:apiId/versions/:apiVersionId/environment'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment';
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}}/apis/:apiId/versions/:apiVersionId/environment"]
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}}/apis/:apiId/versions/:apiVersionId/environment" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment",
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}}/apis/:apiId/versions/:apiVersionId/environment');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/environment")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment")
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/apis/:apiId/versions/:apiVersionId/environment') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment";
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}}/apis/:apiId/versions/:apiVersionId/environment
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/environment")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"environment": [
{
"id": "2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
},
{
"id": "521b0486-ab91-4d3a-9189-43c9380a0533",
"name": "C1",
"updatedAt": "2019-08-29T11:40:39.000Z"
}
]
}
GET
Get integration test relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest"
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}}/apis/:apiId/versions/:apiVersionId/integrationtest"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest"
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/apis/:apiId/versions/:apiVersionId/integrationtest HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest"))
.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}}/apis/:apiId/versions/:apiVersionId/integrationtest")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest")
.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}}/apis/:apiId/versions/:apiVersionId/integrationtest');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest';
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}}/apis/:apiId/versions/:apiVersionId/integrationtest',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/integrationtest',
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}}/apis/:apiId/versions/:apiVersionId/integrationtest'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest');
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}}/apis/:apiId/versions/:apiVersionId/integrationtest'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest';
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}}/apis/:apiId/versions/:apiVersionId/integrationtest"]
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}}/apis/:apiId/versions/:apiVersionId/integrationtest" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest",
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}}/apis/:apiId/versions/:apiVersionId/integrationtest');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/integrationtest")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest")
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/apis/:apiId/versions/:apiVersionId/integrationtest') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest";
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}}/apis/:apiId/versions/:apiVersionId/integrationtest
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/integrationtest")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"integrationtest": [
{
"collectionId": "7732157-a8bcd149-2b01-4b4c-8c14-c7d05be77745",
"id": "2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
},
{
"collectionId": "7332157-a8bcd143-2b01-4b12-8c14-c7d05be77725",
"id": "521b0486-ab91-4d3a-9189-43c9380a0533",
"name": "C1",
"updatedAt": "2019-08-29T11:40:39.000Z"
}
]
}
GET
Get linked relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
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}}/apis/:apiId/versions/:apiVersionId/relations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
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/apis/:apiId/versions/:apiVersionId/relations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"))
.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}}/apis/:apiId/versions/:apiVersionId/relations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
.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}}/apis/:apiId/versions/:apiVersionId/relations');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations';
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}}/apis/:apiId/versions/:apiVersionId/relations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/relations',
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}}/apis/:apiId/versions/:apiVersionId/relations'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations');
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}}/apis/:apiId/versions/:apiVersionId/relations'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations';
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}}/apis/:apiId/versions/:apiVersionId/relations"]
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}}/apis/:apiId/versions/:apiVersionId/relations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations",
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}}/apis/:apiId/versions/:apiVersionId/relations');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/relations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")
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/apis/:apiId/versions/:apiVersionId/relations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations";
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}}/apis/:apiId/versions/:apiVersionId/relations
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/relations")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"relations": {
"contracttest": {
"2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2": {
"id": "2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
}
},
"integrationtest": {
"521b0486-ab91-4d3a-9189-43c9380a0533": {
"id": "521b0486-ab91-4d3a-9189-43c9380a0533",
"name": "C1",
"updatedAt": "2019-08-29T11:40:39.000Z"
},
"a236b715-e682-460b-97b6-c1db24f7612e": {
"id": "a236b715-e682-460b-97b6-c1db24f7612e",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
}
},
"mock": {
"4ccd755f-2c80-481b-a262-49b55e12f5e1": {
"id": "4ccd755f-2c80-481b-a262-49b55e12f5e1",
"name": "Mock",
"updatedAt": "2019-08-20T10:18:13.000Z",
"url": "https://4ccd755f-2c80-481b-a262-49b55e12f5e1.mock-beta.pstmn.io"
}
}
}
}
GET
Get monitor relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor"
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}}/apis/:apiId/versions/:apiVersionId/monitor"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor"
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/apis/:apiId/versions/:apiVersionId/monitor HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor"))
.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}}/apis/:apiId/versions/:apiVersionId/monitor")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor")
.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}}/apis/:apiId/versions/:apiVersionId/monitor');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor';
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}}/apis/:apiId/versions/:apiVersionId/monitor',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/monitor',
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}}/apis/:apiId/versions/:apiVersionId/monitor'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor');
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}}/apis/:apiId/versions/:apiVersionId/monitor'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor';
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}}/apis/:apiId/versions/:apiVersionId/monitor"]
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}}/apis/:apiId/versions/:apiVersionId/monitor" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor",
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}}/apis/:apiId/versions/:apiVersionId/monitor');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/monitor")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor")
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/apis/:apiId/versions/:apiVersionId/monitor') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor";
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}}/apis/:apiId/versions/:apiVersionId/monitor
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/monitor")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"monitor": [
{
"id": "2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2",
"monitorId": "7732157-a8bcd149-2b01-4b4c-8c14-c7d05be77745",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
},
{
"id": "521b0486-ab91-4d3a-9189-43c9380a0533",
"monitorId": "7332157-a8bcd143-2b01-4b12-8c14-c7d05be77725",
"name": "C1",
"updatedAt": "2019-08-29T11:40:39.000Z"
}
]
}
GET
Get test suite relations
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite"
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}}/apis/:apiId/versions/:apiVersionId/testsuite"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite"
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/apis/:apiId/versions/:apiVersionId/testsuite HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite"))
.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}}/apis/:apiId/versions/:apiVersionId/testsuite")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite")
.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}}/apis/:apiId/versions/:apiVersionId/testsuite');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite';
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}}/apis/:apiId/versions/:apiVersionId/testsuite',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/testsuite',
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}}/apis/:apiId/versions/:apiVersionId/testsuite'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite');
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}}/apis/:apiId/versions/:apiVersionId/testsuite'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite';
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}}/apis/:apiId/versions/:apiVersionId/testsuite"]
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}}/apis/:apiId/versions/:apiVersionId/testsuite" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite",
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}}/apis/:apiId/versions/:apiVersionId/testsuite');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId/versions/:apiVersionId/testsuite")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite")
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/apis/:apiId/versions/:apiVersionId/testsuite') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite";
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}}/apis/:apiId/versions/:apiVersionId/testsuite
http GET {{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/testsuite")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"testsuite": [
{
"collectionId": "7732157-a8bcd149-2b01-4b4c-8c14-c7d05be77745",
"id": "2a9b8fa8-88b7-4b86-8372-8e3f6f6e07f2",
"name": "C test",
"updatedAt": "2019-08-29T10:18:11.000Z"
},
{
"collectionId": "7332157-a8bcd143-2b01-4b12-8c14-c7d05be77725",
"id": "521b0486-ab91-4d3a-9189-43c9380a0533",
"name": "C1",
"updatedAt": "2019-08-29T11:40:39.000Z"
}
]
}
GET
Single API
{{baseUrl}}/apis/:apiId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/apis/:apiId")
require "http/client"
url = "{{baseUrl}}/apis/:apiId"
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}}/apis/:apiId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId"
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/apis/:apiId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/apis/:apiId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId"))
.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}}/apis/:apiId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/apis/:apiId")
.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}}/apis/:apiId');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/apis/:apiId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId';
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}}/apis/:apiId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId',
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}}/apis/:apiId'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/apis/:apiId');
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}}/apis/:apiId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId';
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}}/apis/:apiId"]
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}}/apis/:apiId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId",
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}}/apis/:apiId');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/apis/:apiId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId")
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/apis/:apiId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId";
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}}/apis/:apiId
http GET {{baseUrl}}/apis/:apiId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/apis/:apiId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"api": {
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"description": "This is a description.This is a description.",
"id": "387c2863-6ee3-4a56-8210-225f774edade",
"name": "Sync API",
"summary": "This is a summary",
"updatedAt": "2019-02-12 19:34:49"
}
}
PUT
Sync relations with schema
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema"
response = HTTP::Client.put url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema");
var request = new RestRequest("", Method.Put);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema"))
.method("PUT", 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}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")
.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('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema';
const options = {method: 'PUT'};
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}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")
.put(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema',
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: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema';
const options = {method: 'PUT'};
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}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
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}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema');
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.put('/baseUrl/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema
http PUT {{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/:entityType/:entityId/syncWithSchema")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"success": true
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "Unable to validate. Only the OpenAPI 3.0 schema format is supported.",
"name": "validationFailed"
}
}
PUT
Update Schema
{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId
BODY json
{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId");
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 \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId" {:content-type :json
:form-params {:schema {:language ""
:schema ""
:type ""}}})
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"),
Content = new StringContent("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
payload := strings.NewReader("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 74
{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.setHeader("content-type", "application/json")
.setBody("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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 \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.header("content-type", "application/json")
.body("{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
schema: {
language: '',
schema: '',
type: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId',
headers: {'content-type': 'application/json'},
data: {schema: {language: '', schema: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"schema":{"language":"","schema":"","type":""}}'
};
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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "schema": {\n "language": "",\n "schema": "",\n "type": ""\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 \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId',
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({schema: {language: '', schema: '', type: ''}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId',
headers: {'content-type': 'application/json'},
body: {schema: {language: '', schema: '', type: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
schema: {
language: '',
schema: '',
type: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId',
headers: {'content-type': 'application/json'},
data: {schema: {language: '', schema: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"schema":{"language":"","schema":"","type":""}}'
};
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 = @{ @"schema": @{ @"language": @"", @"schema": @"", @"type": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'schema' => [
'language' => '',
'schema' => '',
'type' => ''
]
]),
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('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId', [
'body' => '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'schema' => [
'language' => '',
'schema' => '',
'type' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'schema' => [
'language' => '',
'schema' => '',
'type' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId');
$request->setRequestMethod('PUT');
$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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
payload = { "schema": {
"language": "",
"schema": "",
"type": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId"
payload <- "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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.put('/baseUrl/apis/:apiId/versions/:apiVersionId/schemas/:schemaId') do |req|
req.body = "{\n \"schema\": {\n \"language\": \"\",\n \"schema\": \"\",\n \"type\": \"\"\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}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId";
let payload = json!({"schema": json!({
"language": "",
"schema": "",
"type": ""
})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId \
--header 'content-type: application/json' \
--data '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}'
echo '{
"schema": {
"language": "",
"schema": "",
"type": ""
}
}' | \
http PUT {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "schema": {\n "language": "",\n "schema": "",\n "type": ""\n }\n}' \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["schema": [
"language": "",
"schema": "",
"type": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId/schemas/:schemaId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"schema": {
"apiVersion": "ad810c39-df60-434e-a76f-a2192cd8d81f",
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"id": "e3b3a0b7-34d5-4fc5-83e0-118bd9e8c822",
"language": "yaml",
"type": "openapi3",
"updateBy": "5665",
"updatedAt": "2019-02-12 19:34:49"
}
}
PUT
Update an API Version
{{baseUrl}}/apis/:apiId/versions/:apiVersionId
BODY json
{
"version": {
"name": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId/versions/:apiVersionId");
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 \"version\": {\n \"name\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/apis/:apiId/versions/:apiVersionId" {:content-type :json
:form-params {:version {:name ""}}})
require "http/client"
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"version\": {\n \"name\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/apis/:apiId/versions/:apiVersionId"),
Content = new StringContent("{\n \"version\": {\n \"name\": \"\"\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}}/apis/:apiId/versions/:apiVersionId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"version\": {\n \"name\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
payload := strings.NewReader("{\n \"version\": {\n \"name\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/apis/:apiId/versions/:apiVersionId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 37
{
"version": {
"name": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.setHeader("content-type", "application/json")
.setBody("{\n \"version\": {\n \"name\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId/versions/:apiVersionId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"version\": {\n \"name\": \"\"\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 \"version\": {\n \"name\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.header("content-type", "application/json")
.body("{\n \"version\": {\n \"name\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
version: {
name: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId',
headers: {'content-type': 'application/json'},
data: {version: {name: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"version":{"name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "version": {\n "name": ""\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 \"version\": {\n \"name\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId/versions/:apiVersionId',
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({version: {name: ''}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId',
headers: {'content-type': 'application/json'},
body: {version: {name: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
version: {
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: 'PUT',
url: '{{baseUrl}}/apis/:apiId/versions/:apiVersionId',
headers: {'content-type': 'application/json'},
data: {version: {name: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId/versions/:apiVersionId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"version":{"name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"version": @{ @"name": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis/:apiId/versions/:apiVersionId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/apis/:apiId/versions/:apiVersionId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"version\": {\n \"name\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId/versions/:apiVersionId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'version' => [
'name' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/apis/:apiId/versions/:apiVersionId', [
'body' => '{
"version": {
"name": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'version' => [
'name' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'version' => [
'name' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/apis/:apiId/versions/:apiVersionId');
$request->setRequestMethod('PUT');
$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}}/apis/:apiId/versions/:apiVersionId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"version": {
"name": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId/versions/:apiVersionId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"version": {
"name": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"version\": {\n \"name\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/apis/:apiId/versions/:apiVersionId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
payload = { "version": { "name": "" } }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId/versions/:apiVersionId"
payload <- "{\n \"version\": {\n \"name\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId/versions/:apiVersionId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"version\": {\n \"name\": \"\"\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.put('/baseUrl/apis/:apiId/versions/:apiVersionId') do |req|
req.body = "{\n \"version\": {\n \"name\": \"\"\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}}/apis/:apiId/versions/:apiVersionId";
let payload = json!({"version": json!({"name": ""})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/apis/:apiId/versions/:apiVersionId \
--header 'content-type: application/json' \
--data '{
"version": {
"name": ""
}
}'
echo '{
"version": {
"name": ""
}
}' | \
http PUT {{baseUrl}}/apis/:apiId/versions/:apiVersionId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "version": {\n "name": ""\n }\n}' \
--output-document \
- {{baseUrl}}/apis/:apiId/versions/:apiVersionId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["version": ["name": ""]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId/versions/:apiVersionId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"version": {
"api": "2b95d07c-8379-4bd1-924f-e7e1af185284",
"createdAt": "2019-07-26T11:24:15.000Z",
"createdBy": "12",
"id": "d71cf403-c549-4c7c-9dc6-a6a105acf67c",
"name": "2.0",
"updatedAt": "2019-08-09T09:27:36.000Z",
"updatedBy": "5665"
}
}
PUT
Update an API
{{baseUrl}}/apis/:apiId
BODY json
{
"api": {
"description": "",
"name": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/apis/:apiId");
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 \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/apis/:apiId" {:content-type :json
:form-params {:api {:description ""
:name ""}}})
require "http/client"
url = "{{baseUrl}}/apis/:apiId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/apis/:apiId"),
Content = new StringContent("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\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}}/apis/:apiId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/apis/:apiId"
payload := strings.NewReader("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/apis/:apiId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 56
{
"api": {
"description": "",
"name": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/apis/:apiId")
.setHeader("content-type", "application/json")
.setBody("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/apis/:apiId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\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 \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/apis/:apiId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/apis/:apiId")
.header("content-type", "application/json")
.body("{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
api: {
description: '',
name: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/apis/:apiId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId',
headers: {'content-type': 'application/json'},
data: {api: {description: '', name: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/apis/:apiId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"api":{"description":"","name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/apis/:apiId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "api": {\n "description": "",\n "name": ""\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 \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/apis/:apiId")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/apis/:apiId',
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({api: {description: '', name: ''}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/apis/:apiId',
headers: {'content-type': 'application/json'},
body: {api: {description: '', name: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/apis/:apiId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
api: {
description: '',
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: 'PUT',
url: '{{baseUrl}}/apis/:apiId',
headers: {'content-type': 'application/json'},
data: {api: {description: '', name: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/apis/:apiId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"api":{"description":"","name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"api": @{ @"description": @"", @"name": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/apis/:apiId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/apis/:apiId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/apis/:apiId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'api' => [
'description' => '',
'name' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/apis/:apiId', [
'body' => '{
"api": {
"description": "",
"name": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/apis/:apiId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'api' => [
'description' => '',
'name' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'api' => [
'description' => '',
'name' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/apis/:apiId');
$request->setRequestMethod('PUT');
$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}}/apis/:apiId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"api": {
"description": "",
"name": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/apis/:apiId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"api": {
"description": "",
"name": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/apis/:apiId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/apis/:apiId"
payload = { "api": {
"description": "",
"name": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/apis/:apiId"
payload <- "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/apis/:apiId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\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.put('/baseUrl/apis/:apiId') do |req|
req.body = "{\n \"api\": {\n \"description\": \"\",\n \"name\": \"\"\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}}/apis/:apiId";
let payload = json!({"api": json!({
"description": "",
"name": ""
})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/apis/:apiId \
--header 'content-type: application/json' \
--data '{
"api": {
"description": "",
"name": ""
}
}'
echo '{
"api": {
"description": "",
"name": ""
}
}' | \
http PUT {{baseUrl}}/apis/:apiId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "api": {\n "description": "",\n "name": ""\n }\n}' \
--output-document \
- {{baseUrl}}/apis/:apiId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["api": [
"description": "",
"name": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/apis/:apiId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"api": {
"createdAt": "2019-02-12 19:34:49",
"createdBy": "5665",
"description": "This is a description.",
"id": "387c2863-6ee3-4a56-8210-225f774edade",
"name": "Sync API",
"summary": "This is a summary",
"updatedAt": "2019-02-12 19:34:49"
}
}
GET
All Collections
{{baseUrl}}/collections
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections")
require "http/client"
url = "{{baseUrl}}/collections"
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}}/collections"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections"
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/collections HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections"))
.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}}/collections")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections")
.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}}/collections');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/collections'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections';
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}}/collections',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections',
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}}/collections'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections');
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}}/collections'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections';
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}}/collections"]
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}}/collections" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections",
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}}/collections');
echo $response->getBody();
setUrl('{{baseUrl}}/collections');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections")
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/collections') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections";
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}}/collections
http GET {{baseUrl}}/collections
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collections": [
{
"id": "dac5eac9-148d-a32e-b76b-3edee9da28f7",
"name": "Cloud API",
"owner": "631643",
"uid": "631643-dac5eac9-148d-a32e-b76b-3edee9da28f7"
},
{
"id": "f2e66c2e-5297-e4a5-739e-20cbb90900e3",
"name": "Sample Collection",
"owner": "631643",
"uid": "631643-f2e66c2e-5297-e4a5-739e-20cbb90900e3"
},
{
"id": "f695cab7-6878-eb55-7943-ad88e1ccfd65",
"name": "Postman Echo",
"owner": "631643",
"uid": "631643-f695cab7-6878-eb55-7943-ad88e1ccfd65"
}
]
}
POST
Create Collection
{{baseUrl}}/collections
BODY json
{
"collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections");
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 \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections" {:content-type :json
:form-params {:collection {:info {:description ""
:name ""
:schema ""}
:item [{:item [{:name ""
:request {:body {:mode ""
:raw ""}
:description ""
:header [{:key ""
:value ""}]
:method ""
:url ""}}]
:name ""}]}}})
require "http/client"
url = "{{baseUrl}}/collections"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections"),
Content = new StringContent("{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections"
payload := strings.NewReader("{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 597
{
"collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections")
.setHeader("content-type", "application/json")
.setBody("{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections")
.header("content-type", "application/json")
.body("{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
collection: {
info: {
description: '',
name: '',
schema: ''
},
item: [
{
item: [
{
name: '',
request: {
body: {
mode: '',
raw: ''
},
description: '',
header: [
{
key: '',
value: ''
}
],
method: '',
url: ''
}
}
],
name: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections',
headers: {'content-type': 'application/json'},
data: {
collection: {
info: {description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"collection":{"info":{"description":"","name":"","schema":""},"item":[{"item":[{"name":"","request":{"body":{"mode":"","raw":""},"description":"","header":[{"key":"","value":""}],"method":"","url":""}}],"name":""}]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "collection": {\n "info": {\n "description": "",\n "name": "",\n "schema": ""\n },\n "item": [\n {\n "item": [\n {\n "name": "",\n "request": {\n "body": {\n "mode": "",\n "raw": ""\n },\n "description": "",\n "header": [\n {\n "key": "",\n "value": ""\n }\n ],\n "method": "",\n "url": ""\n }\n }\n ],\n "name": ""\n }\n ]\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/collections")
.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/collections',
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({
collection: {
info: {description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections',
headers: {'content-type': 'application/json'},
body: {
collection: {
info: {description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
collection: {
info: {
description: '',
name: '',
schema: ''
},
item: [
{
item: [
{
name: '',
request: {
body: {
mode: '',
raw: ''
},
description: '',
header: [
{
key: '',
value: ''
}
],
method: '',
url: ''
}
}
],
name: ''
}
]
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections',
headers: {'content-type': 'application/json'},
data: {
collection: {
info: {description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"collection":{"info":{"description":"","name":"","schema":""},"item":[{"item":[{"name":"","request":{"body":{"mode":"","raw":""},"description":"","header":[{"key":"","value":""}],"method":"","url":""}}],"name":""}]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"collection": @{ @"info": @{ @"description": @"", @"name": @"", @"schema": @"" }, @"item": @[ @{ @"item": @[ @{ @"name": @"", @"request": @{ @"body": @{ @"mode": @"", @"raw": @"" }, @"description": @"", @"header": @[ @{ @"key": @"", @"value": @"" } ], @"method": @"", @"url": @"" } } ], @"name": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections"]
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}}/collections" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections",
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([
'collection' => [
'info' => [
'description' => '',
'name' => '',
'schema' => ''
],
'item' => [
[
'item' => [
[
'name' => '',
'request' => [
'body' => [
'mode' => '',
'raw' => ''
],
'description' => '',
'header' => [
[
'key' => '',
'value' => ''
]
],
'method' => '',
'url' => ''
]
]
],
'name' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections', [
'body' => '{
"collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'collection' => [
'info' => [
'description' => '',
'name' => '',
'schema' => ''
],
'item' => [
[
'item' => [
[
'name' => '',
'request' => [
'body' => [
'mode' => '',
'raw' => ''
],
'description' => '',
'header' => [
[
'key' => '',
'value' => ''
]
],
'method' => '',
'url' => ''
]
]
],
'name' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'collection' => [
'info' => [
'description' => '',
'name' => '',
'schema' => ''
],
'item' => [
[
'item' => [
[
'name' => '',
'request' => [
'body' => [
'mode' => '',
'raw' => ''
],
'description' => '',
'header' => [
[
'key' => '',
'value' => ''
]
],
'method' => '',
'url' => ''
]
]
],
'name' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/collections');
$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}}/collections' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections"
payload = { "collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections"
payload <- "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections")
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 \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections') do |req|
req.body = "{\n \"collection\": {\n \"info\": {\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections";
let payload = json!({"collection": json!({
"info": json!({
"description": "",
"name": "",
"schema": ""
}),
"item": (
json!({
"item": (
json!({
"name": "",
"request": json!({
"body": json!({
"mode": "",
"raw": ""
}),
"description": "",
"header": (
json!({
"key": "",
"value": ""
})
),
"method": "",
"url": ""
})
})
),
"name": ""
})
)
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections \
--header 'content-type: application/json' \
--data '{
"collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}'
echo '{
"collection": {
"info": {
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}' | \
http POST {{baseUrl}}/collections \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "collection": {\n "info": {\n "description": "",\n "name": "",\n "schema": ""\n },\n "item": [\n {\n "item": [\n {\n "name": "",\n "request": {\n "body": {\n "mode": "",\n "raw": ""\n },\n "description": "",\n "header": [\n {\n "key": "",\n "value": ""\n }\n ],\n "method": "",\n "url": ""\n }\n }\n ],\n "name": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/collections
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["collection": [
"info": [
"description": "",
"name": "",
"schema": ""
],
"item": [
[
"item": [
[
"name": "",
"request": [
"body": [
"mode": "",
"raw": ""
],
"description": "",
"header": [
[
"key": "",
"value": ""
]
],
"method": "",
"url": ""
]
]
],
"name": ""
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collection": {
"id": "2412a72c-1d8e-491b-aced-93809c0e94e9",
"name": "Sample Collection",
"uid": "5852-2412a72c-1d8e-491b-aced-93809c0e94e9"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "Missing required property: name at info",
"name": "malformedRequestError"
}
}
POST
Create a Fork
{{baseUrl}}/collections/fork/:collection_uid
BODY json
{
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/fork/:collection_uid");
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\": \"Fork name\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/fork/:collection_uid" {:content-type :json
:form-params {:name "Fork name"}})
require "http/client"
url = "{{baseUrl}}/collections/fork/:collection_uid"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"Fork name\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections/fork/:collection_uid"),
Content = new StringContent("{\n \"name\": \"Fork name\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/fork/:collection_uid");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"Fork name\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/fork/:collection_uid"
payload := strings.NewReader("{\n \"name\": \"Fork name\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections/fork/:collection_uid HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 25
{
"name": "Fork name"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/fork/:collection_uid")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"Fork name\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/fork/:collection_uid"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"Fork name\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"Fork name\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/fork/:collection_uid")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/fork/:collection_uid")
.header("content-type", "application/json")
.body("{\n \"name\": \"Fork name\"\n}")
.asString();
const data = JSON.stringify({
name: 'Fork name'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/fork/:collection_uid');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/fork/:collection_uid',
headers: {'content-type': 'application/json'},
data: {name: 'Fork name'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/fork/:collection_uid';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"Fork name"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/fork/:collection_uid',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "Fork name"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"Fork name\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/fork/:collection_uid")
.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/collections/fork/:collection_uid',
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: 'Fork name'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/fork/:collection_uid',
headers: {'content-type': 'application/json'},
body: {name: 'Fork name'},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections/fork/:collection_uid');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: 'Fork name'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/fork/:collection_uid',
headers: {'content-type': 'application/json'},
data: {name: 'Fork name'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/fork/:collection_uid';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"Fork name"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"Fork name" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/fork/:collection_uid"]
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}}/collections/fork/:collection_uid" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"Fork name\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/fork/:collection_uid",
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' => 'Fork name'
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections/fork/:collection_uid', [
'body' => '{
"name": "Fork name"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/fork/:collection_uid');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => 'Fork name'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => 'Fork name'
]));
$request->setRequestUrl('{{baseUrl}}/collections/fork/:collection_uid');
$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}}/collections/fork/:collection_uid' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "Fork name"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/fork/:collection_uid' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "Fork name"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"Fork name\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/fork/:collection_uid", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/fork/:collection_uid"
payload = { "name": "Fork name" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/fork/:collection_uid"
payload <- "{\n \"name\": \"Fork name\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/fork/:collection_uid")
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\": \"Fork name\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections/fork/:collection_uid') do |req|
req.body = "{\n \"name\": \"Fork name\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/fork/:collection_uid";
let payload = json!({"name": "Fork name"});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections/fork/:collection_uid \
--header 'content-type: application/json' \
--data '{
"name": "Fork name"
}'
echo '{
"name": "Fork name"
}' | \
http POST {{baseUrl}}/collections/fork/:collection_uid \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "name": "Fork name"\n}' \
--output-document \
- {{baseUrl}}/collections/fork/:collection_uid
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["name": "Fork name"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/fork/:collection_uid")! 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
Delete Collection
{{baseUrl}}/collections/:collection_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/collections/:collection_uid")
require "http/client"
url = "{{baseUrl}}/collections/:collection_uid"
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}}/collections/:collection_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_uid");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_uid"
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/collections/:collection_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/collections/:collection_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_uid"))
.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}}/collections/:collection_uid")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/collections/:collection_uid")
.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}}/collections/:collection_uid');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_uid'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_uid';
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}}/collections/:collection_uid',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_uid")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_uid',
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}}/collections/:collection_uid'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/collections/:collection_uid');
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}}/collections/:collection_uid'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_uid';
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}}/collections/:collection_uid"]
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}}/collections/:collection_uid" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_uid",
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}}/collections/:collection_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_uid');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_uid');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_uid' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_uid' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/collections/:collection_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_uid"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_uid"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_uid")
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/collections/:collection_uid') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_uid";
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}}/collections/:collection_uid
http DELETE {{baseUrl}}/collections/:collection_uid
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/collections/:collection_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collection": {
"id": "a14c6da7-afba-4a84-bf22-4febbaaced6c",
"uid": "5852-a14c6da7-afba-4a84-bf22-4febbaaced6c"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"details": {
"id": "a14c6da7-afba-4a84-bf22-4febbaaced6c",
"item": "collection"
},
"message": "The specified item does not exist.",
"name": "instanceNotFoundError"
}
}
POST
Merge a Fork
{{baseUrl}}/collections/merge
BODY json
{
"destination": "",
"source": "",
"strategy": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/merge");
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 \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/merge" {:content-type :json
:form-params {:destination "{{destination_collection_uid}}"
:source "{{source_collection_uid}}"
:strategy "deleteSource"}})
require "http/client"
url = "{{baseUrl}}/collections/merge"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\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}}/collections/merge"),
Content = new StringContent("{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\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}}/collections/merge");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/merge"
payload := strings.NewReader("{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\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/collections/merge HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 124
{
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/merge")
.setHeader("content-type", "application/json")
.setBody("{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/merge"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\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 \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/merge")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/merge")
.header("content-type", "application/json")
.body("{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}")
.asString();
const data = JSON.stringify({
destination: '{{destination_collection_uid}}',
source: '{{source_collection_uid}}',
strategy: 'deleteSource'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/merge');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/merge',
headers: {'content-type': 'application/json'},
data: {
destination: '{{destination_collection_uid}}',
source: '{{source_collection_uid}}',
strategy: 'deleteSource'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/merge';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"destination":"{{destination_collection_uid}}","source":"{{source_collection_uid}}","strategy":"deleteSource"}'
};
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}}/collections/merge',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "destination": "{{destination_collection_uid}}",\n "source": "{{source_collection_uid}}",\n "strategy": "deleteSource"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/merge")
.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/collections/merge',
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({
destination: '{{destination_collection_uid}}',
source: '{{source_collection_uid}}',
strategy: 'deleteSource'
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/merge',
headers: {'content-type': 'application/json'},
body: {
destination: '{{destination_collection_uid}}',
source: '{{source_collection_uid}}',
strategy: 'deleteSource'
},
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}}/collections/merge');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
destination: '{{destination_collection_uid}}',
source: '{{source_collection_uid}}',
strategy: 'deleteSource'
});
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}}/collections/merge',
headers: {'content-type': 'application/json'},
data: {
destination: '{{destination_collection_uid}}',
source: '{{source_collection_uid}}',
strategy: 'deleteSource'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/merge';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"destination":"{{destination_collection_uid}}","source":"{{source_collection_uid}}","strategy":"deleteSource"}'
};
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 = @{ @"destination": @"{{destination_collection_uid}}",
@"source": @"{{source_collection_uid}}",
@"strategy": @"deleteSource" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/merge"]
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}}/collections/merge" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/merge",
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([
'destination' => '{{destination_collection_uid}}',
'source' => '{{source_collection_uid}}',
'strategy' => 'deleteSource'
]),
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}}/collections/merge', [
'body' => '{
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/merge');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'destination' => '{{destination_collection_uid}}',
'source' => '{{source_collection_uid}}',
'strategy' => 'deleteSource'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'destination' => '{{destination_collection_uid}}',
'source' => '{{source_collection_uid}}',
'strategy' => 'deleteSource'
]));
$request->setRequestUrl('{{baseUrl}}/collections/merge');
$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}}/collections/merge' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/merge' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/merge", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/merge"
payload = {
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/merge"
payload <- "{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\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}}/collections/merge")
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 \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\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/collections/merge') do |req|
req.body = "{\n \"destination\": \"{{destination_collection_uid}}\",\n \"source\": \"{{source_collection_uid}}\",\n \"strategy\": \"deleteSource\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/merge";
let payload = json!({
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
});
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}}/collections/merge \
--header 'content-type: application/json' \
--data '{
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
}'
echo '{
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
}' | \
http POST {{baseUrl}}/collections/merge \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "destination": "{{destination_collection_uid}}",\n "source": "{{source_collection_uid}}",\n "strategy": "deleteSource"\n}' \
--output-document \
- {{baseUrl}}/collections/merge
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"destination": "{{destination_collection_uid}}",
"source": "{{source_collection_uid}}",
"strategy": "deleteSource"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/merge")! 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
Single Collection
{{baseUrl}}/collections/:collection_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_uid")
require "http/client"
url = "{{baseUrl}}/collections/:collection_uid"
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}}/collections/:collection_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_uid");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_uid"
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/collections/:collection_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_uid"))
.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}}/collections/:collection_uid")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_uid")
.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}}/collections/:collection_uid');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/collections/:collection_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_uid';
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}}/collections/:collection_uid',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_uid")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_uid',
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}}/collections/:collection_uid'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_uid');
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}}/collections/:collection_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_uid';
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}}/collections/:collection_uid"]
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}}/collections/:collection_uid" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_uid",
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}}/collections/:collection_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_uid');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_uid');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_uid' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_uid' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_uid"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_uid"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_uid")
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/collections/:collection_uid') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_uid";
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}}/collections/:collection_uid
http GET {{baseUrl}}/collections/:collection_uid
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collection": {
"info": {
"_postman_id": "f2e66c2e-5297-e4a5-739e-20cbb90900e3",
"description": "This is a sample collection that makes a tiny request to Postman Echo service to get the list of request headers sent by a HTTP client.",
"name": "Sample Collection",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"event": [
{
"listen": "test",
"script": {
"exec": "var responseJSON;\ntry {\n tests[\"Body contains headers\"] = responseBody.has(\"headers\");\n responseJSON = JSON.parse(responseBody);\n tests[\"Header contains host\"] = \"host\" in responseJSON.headers;\n tests[\"Header contains test parameter sent as part of request header\"] = \"my-sample-header\" in responseJSON.headers;\n}\ncatch (e) { }\n\n\n\n",
"type": "text/javascript"
}
}
],
"id": "82ee981b-e19f-962a-401e-ea34ebfb4848",
"name": "Request Headers",
"request": {
"body": {
"formdata": [],
"mode": "formdata"
},
"description": "",
"header": [
{
"description": "",
"key": "my-sample-header",
"value": "Lorem ipsum dolor sit amet"
}
],
"method": "GET",
"url": "https://echo.getpostman.com/headers"
},
"response": []
}
],
"variables": []
}
}
PUT
Update Collection
{{baseUrl}}/collections/:collection_uid
BODY json
{
"collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_uid");
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 \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/collections/:collection_uid" {:content-type :json
:form-params {:collection {:info {:_postman_id ""
:description ""
:name ""
:schema ""}
:item [{:item [{:name ""
:request {:body {:mode ""
:raw ""}
:description ""
:header [{:key ""
:value ""}]
:method ""
:url ""}}]
:name ""}]}}})
require "http/client"
url = "{{baseUrl}}/collections/:collection_uid"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_uid"),
Content = new StringContent("{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_uid");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_uid"
payload := strings.NewReader("{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/collections/:collection_uid HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 622
{
"collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/collections/:collection_uid")
.setHeader("content-type", "application/json")
.setBody("{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_uid"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_uid")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/collections/:collection_uid")
.header("content-type", "application/json")
.body("{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
collection: {
info: {
_postman_id: '',
description: '',
name: '',
schema: ''
},
item: [
{
item: [
{
name: '',
request: {
body: {
mode: '',
raw: ''
},
description: '',
header: [
{
key: '',
value: ''
}
],
method: '',
url: ''
}
}
],
name: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/collections/:collection_uid');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/collections/:collection_uid',
headers: {'content-type': 'application/json'},
data: {
collection: {
info: {_postman_id: '', description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"collection":{"info":{"_postman_id":"","description":"","name":"","schema":""},"item":[{"item":[{"name":"","request":{"body":{"mode":"","raw":""},"description":"","header":[{"key":"","value":""}],"method":"","url":""}}],"name":""}]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_uid',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "collection": {\n "info": {\n "_postman_id": "",\n "description": "",\n "name": "",\n "schema": ""\n },\n "item": [\n {\n "item": [\n {\n "name": "",\n "request": {\n "body": {\n "mode": "",\n "raw": ""\n },\n "description": "",\n "header": [\n {\n "key": "",\n "value": ""\n }\n ],\n "method": "",\n "url": ""\n }\n }\n ],\n "name": ""\n }\n ]\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_uid")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_uid',
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({
collection: {
info: {_postman_id: '', description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/collections/:collection_uid',
headers: {'content-type': 'application/json'},
body: {
collection: {
info: {_postman_id: '', description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/collections/:collection_uid');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
collection: {
info: {
_postman_id: '',
description: '',
name: '',
schema: ''
},
item: [
{
item: [
{
name: '',
request: {
body: {
mode: '',
raw: ''
},
description: '',
header: [
{
key: '',
value: ''
}
],
method: '',
url: ''
}
}
],
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: 'PUT',
url: '{{baseUrl}}/collections/:collection_uid',
headers: {'content-type': 'application/json'},
data: {
collection: {
info: {_postman_id: '', description: '', name: '', schema: ''},
item: [
{
item: [
{
name: '',
request: {
body: {mode: '', raw: ''},
description: '',
header: [{key: '', value: ''}],
method: '',
url: ''
}
}
],
name: ''
}
]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"collection":{"info":{"_postman_id":"","description":"","name":"","schema":""},"item":[{"item":[{"name":"","request":{"body":{"mode":"","raw":""},"description":"","header":[{"key":"","value":""}],"method":"","url":""}}],"name":""}]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"collection": @{ @"info": @{ @"_postman_id": @"", @"description": @"", @"name": @"", @"schema": @"" }, @"item": @[ @{ @"item": @[ @{ @"name": @"", @"request": @{ @"body": @{ @"mode": @"", @"raw": @"" }, @"description": @"", @"header": @[ @{ @"key": @"", @"value": @"" } ], @"method": @"", @"url": @"" } } ], @"name": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_uid"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/collections/:collection_uid" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_uid",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'collection' => [
'info' => [
'_postman_id' => '',
'description' => '',
'name' => '',
'schema' => ''
],
'item' => [
[
'item' => [
[
'name' => '',
'request' => [
'body' => [
'mode' => '',
'raw' => ''
],
'description' => '',
'header' => [
[
'key' => '',
'value' => ''
]
],
'method' => '',
'url' => ''
]
]
],
'name' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/collections/:collection_uid', [
'body' => '{
"collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_uid');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'collection' => [
'info' => [
'_postman_id' => '',
'description' => '',
'name' => '',
'schema' => ''
],
'item' => [
[
'item' => [
[
'name' => '',
'request' => [
'body' => [
'mode' => '',
'raw' => ''
],
'description' => '',
'header' => [
[
'key' => '',
'value' => ''
]
],
'method' => '',
'url' => ''
]
]
],
'name' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'collection' => [
'info' => [
'_postman_id' => '',
'description' => '',
'name' => '',
'schema' => ''
],
'item' => [
[
'item' => [
[
'name' => '',
'request' => [
'body' => [
'mode' => '',
'raw' => ''
],
'description' => '',
'header' => [
[
'key' => '',
'value' => ''
]
],
'method' => '',
'url' => ''
]
]
],
'name' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_uid');
$request->setRequestMethod('PUT');
$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}}/collections/:collection_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/collections/:collection_uid", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_uid"
payload = { "collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_uid"
payload <- "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_uid")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/collections/:collection_uid') do |req|
req.body = "{\n \"collection\": {\n \"info\": {\n \"_postman_id\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"schema\": \"\"\n },\n \"item\": [\n {\n \"item\": [\n {\n \"name\": \"\",\n \"request\": {\n \"body\": {\n \"mode\": \"\",\n \"raw\": \"\"\n },\n \"description\": \"\",\n \"header\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"method\": \"\",\n \"url\": \"\"\n }\n }\n ],\n \"name\": \"\"\n }\n ]\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}}/collections/:collection_uid";
let payload = json!({"collection": json!({
"info": json!({
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
}),
"item": (
json!({
"item": (
json!({
"name": "",
"request": json!({
"body": json!({
"mode": "",
"raw": ""
}),
"description": "",
"header": (
json!({
"key": "",
"value": ""
})
),
"method": "",
"url": ""
})
})
),
"name": ""
})
)
})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/collections/:collection_uid \
--header 'content-type: application/json' \
--data '{
"collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}'
echo '{
"collection": {
"info": {
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
},
"item": [
{
"item": [
{
"name": "",
"request": {
"body": {
"mode": "",
"raw": ""
},
"description": "",
"header": [
{
"key": "",
"value": ""
}
],
"method": "",
"url": ""
}
}
],
"name": ""
}
]
}
}' | \
http PUT {{baseUrl}}/collections/:collection_uid \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "collection": {\n "info": {\n "_postman_id": "",\n "description": "",\n "name": "",\n "schema": ""\n },\n "item": [\n {\n "item": [\n {\n "name": "",\n "request": {\n "body": {\n "mode": "",\n "raw": ""\n },\n "description": "",\n "header": [\n {\n "key": "",\n "value": ""\n }\n ],\n "method": "",\n "url": ""\n }\n }\n ],\n "name": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/collections/:collection_uid
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["collection": [
"info": [
"_postman_id": "",
"description": "",
"name": "",
"schema": ""
],
"item": [
[
"item": [
[
"name": "",
"request": [
"body": [
"mode": "",
"raw": ""
],
"description": "",
"header": [
[
"key": "",
"value": ""
]
],
"method": "",
"url": ""
]
]
],
"name": ""
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_uid")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collection": {
"id": "1d3daef4-2037-4584-ab86-bafd8c8f8a55",
"name": "Sample Collection",
"uid": "5852-1d3daef4-2037-4584-ab86-bafd8c8f8a55"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "The collection ID in the path does not match the collection ID in the request body.",
"name": "collectionMismatchError"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "You do not have enough permissions to perform this action.",
"name": "forbiddenError"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"details": {
"id": "1d3daef4-2037-4584-ab86-bafd8c8f8a54",
"item": "collection"
},
"message": "The specified item does not exist.",
"name": "instanceNotFoundError"
}
}
GET
All Environments
{{baseUrl}}/environments
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/environments");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/environments")
require "http/client"
url = "{{baseUrl}}/environments"
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}}/environments"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/environments");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/environments"
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/environments HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/environments")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/environments"))
.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}}/environments")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/environments")
.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}}/environments');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/environments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/environments';
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}}/environments',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/environments")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/environments',
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}}/environments'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/environments');
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}}/environments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/environments';
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}}/environments"]
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}}/environments" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/environments",
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}}/environments');
echo $response->getBody();
setUrl('{{baseUrl}}/environments');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/environments');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/environments' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/environments' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/environments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/environments"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/environments"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/environments")
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/environments') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/environments";
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}}/environments
http GET {{baseUrl}}/environments
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/environments
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/environments")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"environments": [
{
"id": "357668d2-84f1-2264-438b-113095359f80",
"name": "Postman Cloud API",
"owner": "631643",
"uid": "631643-357668d2-84f1-2264-438b-113095359f80"
},
{
"id": "84a119b6-f4b1-9120-5f11-a73b17818d70",
"name": "Postman Cloud API.template",
"owner": "631643",
"uid": "631643-84a119b6-f4b1-9120-5f11-a73b17818d70"
}
]
}
POST
Create Environment
{{baseUrl}}/environments
BODY json
{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/environments");
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 \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/environments" {:content-type :json
:form-params {:environment {:name ""
:values [{:key ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/environments"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/environments"),
Content = new StringContent("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/environments");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/environments"
payload := strings.NewReader("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/environments HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 119
{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/environments")
.setHeader("content-type", "application/json")
.setBody("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/environments"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/environments")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/environments")
.header("content-type", "application/json")
.body("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
environment: {
name: '',
values: [
{
key: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/environments');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/environments',
headers: {'content-type': 'application/json'},
data: {environment: {name: '', values: [{key: '', value: ''}]}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/environments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"environment":{"name":"","values":[{"key":"","value":""}]}}'
};
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}}/environments',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "environment": {\n "name": "",\n "values": [\n {\n "key": "",\n "value": ""\n }\n ]\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/environments")
.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/environments',
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({environment: {name: '', values: [{key: '', value: ''}]}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/environments',
headers: {'content-type': 'application/json'},
body: {environment: {name: '', values: [{key: '', value: ''}]}},
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}}/environments');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
environment: {
name: '',
values: [
{
key: '',
value: ''
}
]
}
});
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}}/environments',
headers: {'content-type': 'application/json'},
data: {environment: {name: '', values: [{key: '', value: ''}]}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/environments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"environment":{"name":"","values":[{"key":"","value":""}]}}'
};
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 = @{ @"environment": @{ @"name": @"", @"values": @[ @{ @"key": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/environments"]
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}}/environments" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/environments",
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([
'environment' => [
'name' => '',
'values' => [
[
'key' => '',
'value' => ''
]
]
]
]),
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}}/environments', [
'body' => '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/environments');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'environment' => [
'name' => '',
'values' => [
[
'key' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'environment' => [
'name' => '',
'values' => [
[
'key' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/environments');
$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}}/environments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/environments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/environments", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/environments"
payload = { "environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/environments"
payload <- "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/environments")
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 \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/environments') do |req|
req.body = "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/environments";
let payload = json!({"environment": json!({
"name": "",
"values": (
json!({
"key": "",
"value": ""
})
)
})});
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}}/environments \
--header 'content-type: application/json' \
--data '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}'
echo '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/environments \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "environment": {\n "name": "",\n "values": [\n {\n "key": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/environments
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["environment": [
"name": "",
"values": [
[
"key": "",
"value": ""
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/environments")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"environment": {
"id": "f158266e-306b-4702-a2b9-e4ede7878b7a",
"name": "Sample Environment Name (required)",
"uid": "5665-f158266e-306b-4702-a2b9-e4ede7878b7a"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "Missing required property: environment",
"name": "malformedRequestError"
}
}
DELETE
Delete Environment
{{baseUrl}}/environments/:environment_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/environments/:environment_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/environments/:environment_uid")
require "http/client"
url = "{{baseUrl}}/environments/:environment_uid"
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}}/environments/:environment_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/environments/:environment_uid");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/environments/:environment_uid"
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/environments/:environment_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/environments/:environment_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/environments/:environment_uid"))
.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}}/environments/:environment_uid")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/environments/:environment_uid")
.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}}/environments/:environment_uid');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/environments/:environment_uid'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/environments/:environment_uid';
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}}/environments/:environment_uid',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/environments/:environment_uid")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/environments/:environment_uid',
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}}/environments/:environment_uid'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/environments/:environment_uid');
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}}/environments/:environment_uid'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/environments/:environment_uid';
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}}/environments/:environment_uid"]
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}}/environments/:environment_uid" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/environments/:environment_uid",
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}}/environments/:environment_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/environments/:environment_uid');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/environments/:environment_uid');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/environments/:environment_uid' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/environments/:environment_uid' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/environments/:environment_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/environments/:environment_uid"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/environments/:environment_uid"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/environments/:environment_uid")
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/environments/:environment_uid') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/environments/:environment_uid";
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}}/environments/:environment_uid
http DELETE {{baseUrl}}/environments/:environment_uid
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/environments/:environment_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/environments/:environment_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"environment": {
"id": "4dfb28a4-9a6c-4ce4-b31a-17c26a8b2cce",
"uid": "5852-4dfb28a4-9a6c-4ce4-b31a-17c26a8b2cce"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "The specified environment does not exist.",
"name": "instanceNotFoundError"
}
}
GET
Single Environment
{{baseUrl}}/environments/:environment_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/environments/:environment_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/environments/:environment_uid")
require "http/client"
url = "{{baseUrl}}/environments/:environment_uid"
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}}/environments/:environment_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/environments/:environment_uid");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/environments/:environment_uid"
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/environments/:environment_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/environments/:environment_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/environments/:environment_uid"))
.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}}/environments/:environment_uid")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/environments/:environment_uid")
.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}}/environments/:environment_uid');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/environments/:environment_uid'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/environments/:environment_uid';
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}}/environments/:environment_uid',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/environments/:environment_uid")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/environments/:environment_uid',
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}}/environments/:environment_uid'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/environments/:environment_uid');
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}}/environments/:environment_uid'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/environments/:environment_uid';
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}}/environments/:environment_uid"]
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}}/environments/:environment_uid" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/environments/:environment_uid",
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}}/environments/:environment_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/environments/:environment_uid');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/environments/:environment_uid');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/environments/:environment_uid' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/environments/:environment_uid' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/environments/:environment_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/environments/:environment_uid"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/environments/:environment_uid"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/environments/:environment_uid")
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/environments/:environment_uid') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/environments/:environment_uid";
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}}/environments/:environment_uid
http GET {{baseUrl}}/environments/:environment_uid
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/environments/:environment_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/environments/:environment_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"environment": {
"id": "84a119b6-f4b1-9120-5f11-a73b17818d70",
"name": "Postman Cloud API.template",
"values": [
{
"enabled": true,
"hovered": false,
"key": "postman_api_key",
"type": "text",
"value": ""
}
]
}
}
PUT
Update Environment
{{baseUrl}}/environments/:environment_uid
BODY json
{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/environments/:environment_uid");
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 \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/environments/:environment_uid" {:content-type :json
:form-params {:environment {:name ""
:values [{:key ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/environments/:environment_uid"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/environments/:environment_uid"),
Content = new StringContent("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/environments/:environment_uid");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/environments/:environment_uid"
payload := strings.NewReader("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/environments/:environment_uid HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 119
{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/environments/:environment_uid")
.setHeader("content-type", "application/json")
.setBody("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/environments/:environment_uid"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/environments/:environment_uid")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/environments/:environment_uid")
.header("content-type", "application/json")
.body("{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
environment: {
name: '',
values: [
{
key: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/environments/:environment_uid');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/environments/:environment_uid',
headers: {'content-type': 'application/json'},
data: {environment: {name: '', values: [{key: '', value: ''}]}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/environments/:environment_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"environment":{"name":"","values":[{"key":"","value":""}]}}'
};
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}}/environments/:environment_uid',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "environment": {\n "name": "",\n "values": [\n {\n "key": "",\n "value": ""\n }\n ]\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/environments/:environment_uid")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/environments/:environment_uid',
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({environment: {name: '', values: [{key: '', value: ''}]}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/environments/:environment_uid',
headers: {'content-type': 'application/json'},
body: {environment: {name: '', values: [{key: '', value: ''}]}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/environments/:environment_uid');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
environment: {
name: '',
values: [
{
key: '',
value: ''
}
]
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/environments/:environment_uid',
headers: {'content-type': 'application/json'},
data: {environment: {name: '', values: [{key: '', value: ''}]}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/environments/:environment_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"environment":{"name":"","values":[{"key":"","value":""}]}}'
};
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 = @{ @"environment": @{ @"name": @"", @"values": @[ @{ @"key": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/environments/:environment_uid"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/environments/:environment_uid" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/environments/:environment_uid",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'environment' => [
'name' => '',
'values' => [
[
'key' => '',
'value' => ''
]
]
]
]),
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('PUT', '{{baseUrl}}/environments/:environment_uid', [
'body' => '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/environments/:environment_uid');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'environment' => [
'name' => '',
'values' => [
[
'key' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'environment' => [
'name' => '',
'values' => [
[
'key' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/environments/:environment_uid');
$request->setRequestMethod('PUT');
$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}}/environments/:environment_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/environments/:environment_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/environments/:environment_uid", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/environments/:environment_uid"
payload = { "environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/environments/:environment_uid"
payload <- "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/environments/:environment_uid")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/environments/:environment_uid') do |req|
req.body = "{\n \"environment\": {\n \"name\": \"\",\n \"values\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\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}}/environments/:environment_uid";
let payload = json!({"environment": json!({
"name": "",
"values": (
json!({
"key": "",
"value": ""
})
)
})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/environments/:environment_uid \
--header 'content-type: application/json' \
--data '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}'
echo '{
"environment": {
"name": "",
"values": [
{
"key": "",
"value": ""
}
]
}
}' | \
http PUT {{baseUrl}}/environments/:environment_uid \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "environment": {\n "name": "",\n "values": [\n {\n "key": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/environments/:environment_uid
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["environment": [
"name": "",
"values": [
[
"key": "",
"value": ""
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/environments/:environment_uid")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"environment": {
"id": "357668d2-84f1-2264-438b-113095359f80",
"name": "New Name",
"uid": "631643-357668d2-84f1-2264-438b-113095359f80"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "Invalid type: null (expected object) at environment.values.0",
"name": "malformedRequestError"
}
}
POST
Import exported data
{{baseUrl}}/import/exported
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/import/exported");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/import/exported")
require "http/client"
url = "{{baseUrl}}/import/exported"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/import/exported"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/import/exported");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/import/exported"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/import/exported HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/import/exported")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/import/exported"))
.method("POST", 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}}/import/exported")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/import/exported")
.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('POST', '{{baseUrl}}/import/exported');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/import/exported'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/import/exported';
const options = {method: 'POST'};
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}}/import/exported',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/import/exported")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/import/exported',
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: 'POST', url: '{{baseUrl}}/import/exported'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/import/exported');
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}}/import/exported'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/import/exported';
const options = {method: 'POST'};
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}}/import/exported"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
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}}/import/exported" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/import/exported",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/import/exported');
echo $response->getBody();
setUrl('{{baseUrl}}/import/exported');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/import/exported');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/import/exported' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/import/exported' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/import/exported")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/import/exported"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/import/exported"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/import/exported")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/import/exported') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/import/exported";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/import/exported
http POST {{baseUrl}}/import/exported
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/import/exported
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/import/exported")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collections": [
{
"id": "b31be584-1b1e-4444-b581-761edf88fe77",
"name": "Swagger Petstore",
"uid": "2282-b31be584-1b1e-4444-b581-761edf88fe77"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"details": {
"param": "type"
},
"message": "The request body is missing a value for the type parameter. Check your request and try again.",
"name": "paramMissingError"
}
}
POST
Import external API specification
{{baseUrl}}/import/openapi
BODY json
{
"input": {
"info": {
"license": {
"name": ""
},
"title": "",
"version": ""
},
"openapi": "",
"paths": {
"/pets": {
"get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": false,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": {
"default": {
"content": {
"application/json": {
"schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": {
"type": ""
}
},
"required": []
}
}
},
"description": ""
}
},
"summary": ""
}
}
},
"servers": [
{
"url": ""
}
]
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/import/openapi");
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 \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/import/openapi" {:content-type :json
:form-params {:input {:info {:license {:name ""}
:title ""
:version ""}
:openapi ""
:paths {:/pets {:get {:operationId ""
:parameters [{:description ""
:in ""
:name ""
:required false
:schema {:format ""
:type ""}}]
:responses {:default {:content {:application/json {:schema {:properties {:code {:format ""
:type ""}
:message {:type ""}}
:required []}}}
:description ""}}
:summary ""}}}
:servers [{:url ""}]}
:type ""}})
require "http/client"
url = "{{baseUrl}}/import/openapi"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\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}}/import/openapi"),
Content = new StringContent("{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\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}}/import/openapi");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/import/openapi"
payload := strings.NewReader("{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\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/import/openapi HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1203
{
"input": {
"info": {
"license": {
"name": ""
},
"title": "",
"version": ""
},
"openapi": "",
"paths": {
"/pets": {
"get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": false,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": {
"default": {
"content": {
"application/json": {
"schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": {
"type": ""
}
},
"required": []
}
}
},
"description": ""
}
},
"summary": ""
}
}
},
"servers": [
{
"url": ""
}
]
},
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/import/openapi")
.setHeader("content-type", "application/json")
.setBody("{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/import/openapi"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\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 \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/import/openapi")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/import/openapi")
.header("content-type", "application/json")
.body("{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
input: {
info: {
license: {
name: ''
},
title: '',
version: ''
},
openapi: '',
paths: {
'/pets': {
get: {
operationId: '',
parameters: [
{
description: '',
in: '',
name: '',
required: false,
schema: {
format: '',
type: ''
}
}
],
responses: {
default: {
content: {
'application/json': {
schema: {
properties: {
code: {
format: '',
type: ''
},
message: {
type: ''
}
},
required: []
}
}
},
description: ''
}
},
summary: ''
}
}
},
servers: [
{
url: ''
}
]
},
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/import/openapi');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/import/openapi',
headers: {'content-type': 'application/json'},
data: {
input: {
info: {license: {name: ''}, title: '', version: ''},
openapi: '',
paths: {
'/pets': {
get: {
operationId: '',
parameters: [
{
description: '',
in: '',
name: '',
required: false,
schema: {format: '', type: ''}
}
],
responses: {
default: {
content: {
'application/json': {
schema: {properties: {code: {format: '', type: ''}, message: {type: ''}}, required: []}
}
},
description: ''
}
},
summary: ''
}
}
},
servers: [{url: ''}]
},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/import/openapi';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"input":{"info":{"license":{"name":""},"title":"","version":""},"openapi":"","paths":{"/pets":{"get":{"operationId":"","parameters":[{"description":"","in":"","name":"","required":false,"schema":{"format":"","type":""}}],"responses":{"default":{"content":{"application/json":{"schema":{"properties":{"code":{"format":"","type":""},"message":{"type":""}},"required":[]}}},"description":""}},"summary":""}}},"servers":[{"url":""}]},"type":""}'
};
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}}/import/openapi',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "input": {\n "info": {\n "license": {\n "name": ""\n },\n "title": "",\n "version": ""\n },\n "openapi": "",\n "paths": {\n "/pets": {\n "get": {\n "operationId": "",\n "parameters": [\n {\n "description": "",\n "in": "",\n "name": "",\n "required": false,\n "schema": {\n "format": "",\n "type": ""\n }\n }\n ],\n "responses": {\n "default": {\n "content": {\n "application/json": {\n "schema": {\n "properties": {\n "code": {\n "format": "",\n "type": ""\n },\n "message": {\n "type": ""\n }\n },\n "required": []\n }\n }\n },\n "description": ""\n }\n },\n "summary": ""\n }\n }\n },\n "servers": [\n {\n "url": ""\n }\n ]\n },\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/import/openapi")
.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/import/openapi',
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({
input: {
info: {license: {name: ''}, title: '', version: ''},
openapi: '',
paths: {
'/pets': {
get: {
operationId: '',
parameters: [
{
description: '',
in: '',
name: '',
required: false,
schema: {format: '', type: ''}
}
],
responses: {
default: {
content: {
'application/json': {
schema: {properties: {code: {format: '', type: ''}, message: {type: ''}}, required: []}
}
},
description: ''
}
},
summary: ''
}
}
},
servers: [{url: ''}]
},
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/import/openapi',
headers: {'content-type': 'application/json'},
body: {
input: {
info: {license: {name: ''}, title: '', version: ''},
openapi: '',
paths: {
'/pets': {
get: {
operationId: '',
parameters: [
{
description: '',
in: '',
name: '',
required: false,
schema: {format: '', type: ''}
}
],
responses: {
default: {
content: {
'application/json': {
schema: {properties: {code: {format: '', type: ''}, message: {type: ''}}, required: []}
}
},
description: ''
}
},
summary: ''
}
}
},
servers: [{url: ''}]
},
type: ''
},
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}}/import/openapi');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
input: {
info: {
license: {
name: ''
},
title: '',
version: ''
},
openapi: '',
paths: {
'/pets': {
get: {
operationId: '',
parameters: [
{
description: '',
in: '',
name: '',
required: false,
schema: {
format: '',
type: ''
}
}
],
responses: {
default: {
content: {
'application/json': {
schema: {
properties: {
code: {
format: '',
type: ''
},
message: {
type: ''
}
},
required: []
}
}
},
description: ''
}
},
summary: ''
}
}
},
servers: [
{
url: ''
}
]
},
type: ''
});
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}}/import/openapi',
headers: {'content-type': 'application/json'},
data: {
input: {
info: {license: {name: ''}, title: '', version: ''},
openapi: '',
paths: {
'/pets': {
get: {
operationId: '',
parameters: [
{
description: '',
in: '',
name: '',
required: false,
schema: {format: '', type: ''}
}
],
responses: {
default: {
content: {
'application/json': {
schema: {properties: {code: {format: '', type: ''}, message: {type: ''}}, required: []}
}
},
description: ''
}
},
summary: ''
}
}
},
servers: [{url: ''}]
},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/import/openapi';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"input":{"info":{"license":{"name":""},"title":"","version":""},"openapi":"","paths":{"/pets":{"get":{"operationId":"","parameters":[{"description":"","in":"","name":"","required":false,"schema":{"format":"","type":""}}],"responses":{"default":{"content":{"application/json":{"schema":{"properties":{"code":{"format":"","type":""},"message":{"type":""}},"required":[]}}},"description":""}},"summary":""}}},"servers":[{"url":""}]},"type":""}'
};
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 = @{ @"input": @{ @"info": @{ @"license": @{ @"name": @"" }, @"title": @"", @"version": @"" }, @"openapi": @"", @"paths": @{ @"/pets": @{ @"get": @{ @"operationId": @"", @"parameters": @[ @{ @"description": @"", @"in": @"", @"name": @"", @"required": @NO, @"schema": @{ @"format": @"", @"type": @"" } } ], @"responses": @{ @"default": @{ @"content": @{ @"application/json": @{ @"schema": @{ @"properties": @{ @"code": @{ @"format": @"", @"type": @"" }, @"message": @{ @"type": @"" } }, @"required": @[ ] } } }, @"description": @"" } }, @"summary": @"" } } }, @"servers": @[ @{ @"url": @"" } ] },
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/import/openapi"]
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}}/import/openapi" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/import/openapi",
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([
'input' => [
'info' => [
'license' => [
'name' => ''
],
'title' => '',
'version' => ''
],
'openapi' => '',
'paths' => [
'/pets' => [
'get' => [
'operationId' => '',
'parameters' => [
[
'description' => '',
'in' => '',
'name' => '',
'required' => null,
'schema' => [
'format' => '',
'type' => ''
]
]
],
'responses' => [
'default' => [
'content' => [
'application/json' => [
'schema' => [
'properties' => [
'code' => [
'format' => '',
'type' => ''
],
'message' => [
'type' => ''
]
],
'required' => [
]
]
]
],
'description' => ''
]
],
'summary' => ''
]
]
],
'servers' => [
[
'url' => ''
]
]
],
'type' => ''
]),
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}}/import/openapi', [
'body' => '{
"input": {
"info": {
"license": {
"name": ""
},
"title": "",
"version": ""
},
"openapi": "",
"paths": {
"/pets": {
"get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": false,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": {
"default": {
"content": {
"application/json": {
"schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": {
"type": ""
}
},
"required": []
}
}
},
"description": ""
}
},
"summary": ""
}
}
},
"servers": [
{
"url": ""
}
]
},
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/import/openapi');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'input' => [
'info' => [
'license' => [
'name' => ''
],
'title' => '',
'version' => ''
],
'openapi' => '',
'paths' => [
'/pets' => [
'get' => [
'operationId' => '',
'parameters' => [
[
'description' => '',
'in' => '',
'name' => '',
'required' => null,
'schema' => [
'format' => '',
'type' => ''
]
]
],
'responses' => [
'default' => [
'content' => [
'application/json' => [
'schema' => [
'properties' => [
'code' => [
'format' => '',
'type' => ''
],
'message' => [
'type' => ''
]
],
'required' => [
]
]
]
],
'description' => ''
]
],
'summary' => ''
]
]
],
'servers' => [
[
'url' => ''
]
]
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'input' => [
'info' => [
'license' => [
'name' => ''
],
'title' => '',
'version' => ''
],
'openapi' => '',
'paths' => [
'/pets' => [
'get' => [
'operationId' => '',
'parameters' => [
[
'description' => '',
'in' => '',
'name' => '',
'required' => null,
'schema' => [
'format' => '',
'type' => ''
]
]
],
'responses' => [
'default' => [
'content' => [
'application/json' => [
'schema' => [
'properties' => [
'code' => [
'format' => '',
'type' => ''
],
'message' => [
'type' => ''
]
],
'required' => [
]
]
]
],
'description' => ''
]
],
'summary' => ''
]
]
],
'servers' => [
[
'url' => ''
]
]
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/import/openapi');
$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}}/import/openapi' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"input": {
"info": {
"license": {
"name": ""
},
"title": "",
"version": ""
},
"openapi": "",
"paths": {
"/pets": {
"get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": false,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": {
"default": {
"content": {
"application/json": {
"schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": {
"type": ""
}
},
"required": []
}
}
},
"description": ""
}
},
"summary": ""
}
}
},
"servers": [
{
"url": ""
}
]
},
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/import/openapi' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"input": {
"info": {
"license": {
"name": ""
},
"title": "",
"version": ""
},
"openapi": "",
"paths": {
"/pets": {
"get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": false,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": {
"default": {
"content": {
"application/json": {
"schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": {
"type": ""
}
},
"required": []
}
}
},
"description": ""
}
},
"summary": ""
}
}
},
"servers": [
{
"url": ""
}
]
},
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/import/openapi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/import/openapi"
payload = {
"input": {
"info": {
"license": { "name": "" },
"title": "",
"version": ""
},
"openapi": "",
"paths": { "/pets": { "get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": False,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": { "default": {
"content": { "application/json": { "schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": { "type": "" }
},
"required": []
} } },
"description": ""
} },
"summary": ""
} } },
"servers": [{ "url": "" }]
},
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/import/openapi"
payload <- "{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\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}}/import/openapi")
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 \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\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/import/openapi') do |req|
req.body = "{\n \"input\": {\n \"info\": {\n \"license\": {\n \"name\": \"\"\n },\n \"title\": \"\",\n \"version\": \"\"\n },\n \"openapi\": \"\",\n \"paths\": {\n \"/pets\": {\n \"get\": {\n \"operationId\": \"\",\n \"parameters\": [\n {\n \"description\": \"\",\n \"in\": \"\",\n \"name\": \"\",\n \"required\": false,\n \"schema\": {\n \"format\": \"\",\n \"type\": \"\"\n }\n }\n ],\n \"responses\": {\n \"default\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"properties\": {\n \"code\": {\n \"format\": \"\",\n \"type\": \"\"\n },\n \"message\": {\n \"type\": \"\"\n }\n },\n \"required\": []\n }\n }\n },\n \"description\": \"\"\n }\n },\n \"summary\": \"\"\n }\n }\n },\n \"servers\": [\n {\n \"url\": \"\"\n }\n ]\n },\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/import/openapi";
let payload = json!({
"input": json!({
"info": json!({
"license": json!({"name": ""}),
"title": "",
"version": ""
}),
"openapi": "",
"paths": json!({"/pets": json!({"get": json!({
"operationId": "",
"parameters": (
json!({
"description": "",
"in": "",
"name": "",
"required": false,
"schema": json!({
"format": "",
"type": ""
})
})
),
"responses": json!({"default": json!({
"content": json!({"application/json": json!({"schema": json!({
"properties": json!({
"code": json!({
"format": "",
"type": ""
}),
"message": json!({"type": ""})
}),
"required": ()
})})}),
"description": ""
})}),
"summary": ""
})})}),
"servers": (json!({"url": ""}))
}),
"type": ""
});
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}}/import/openapi \
--header 'content-type: application/json' \
--data '{
"input": {
"info": {
"license": {
"name": ""
},
"title": "",
"version": ""
},
"openapi": "",
"paths": {
"/pets": {
"get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": false,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": {
"default": {
"content": {
"application/json": {
"schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": {
"type": ""
}
},
"required": []
}
}
},
"description": ""
}
},
"summary": ""
}
}
},
"servers": [
{
"url": ""
}
]
},
"type": ""
}'
echo '{
"input": {
"info": {
"license": {
"name": ""
},
"title": "",
"version": ""
},
"openapi": "",
"paths": {
"/pets": {
"get": {
"operationId": "",
"parameters": [
{
"description": "",
"in": "",
"name": "",
"required": false,
"schema": {
"format": "",
"type": ""
}
}
],
"responses": {
"default": {
"content": {
"application/json": {
"schema": {
"properties": {
"code": {
"format": "",
"type": ""
},
"message": {
"type": ""
}
},
"required": []
}
}
},
"description": ""
}
},
"summary": ""
}
}
},
"servers": [
{
"url": ""
}
]
},
"type": ""
}' | \
http POST {{baseUrl}}/import/openapi \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "input": {\n "info": {\n "license": {\n "name": ""\n },\n "title": "",\n "version": ""\n },\n "openapi": "",\n "paths": {\n "/pets": {\n "get": {\n "operationId": "",\n "parameters": [\n {\n "description": "",\n "in": "",\n "name": "",\n "required": false,\n "schema": {\n "format": "",\n "type": ""\n }\n }\n ],\n "responses": {\n "default": {\n "content": {\n "application/json": {\n "schema": {\n "properties": {\n "code": {\n "format": "",\n "type": ""\n },\n "message": {\n "type": ""\n }\n },\n "required": []\n }\n }\n },\n "description": ""\n }\n },\n "summary": ""\n }\n }\n },\n "servers": [\n {\n "url": ""\n }\n ]\n },\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/import/openapi
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"input": [
"info": [
"license": ["name": ""],
"title": "",
"version": ""
],
"openapi": "",
"paths": ["/pets": ["get": [
"operationId": "",
"parameters": [
[
"description": "",
"in": "",
"name": "",
"required": false,
"schema": [
"format": "",
"type": ""
]
]
],
"responses": ["default": [
"content": ["application/json": ["schema": [
"properties": [
"code": [
"format": "",
"type": ""
],
"message": ["type": ""]
],
"required": []
]]],
"description": ""
]],
"summary": ""
]]],
"servers": [["url": ""]]
],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/import/openapi")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"collections": [
{
"id": "b31be584-1b1e-4444-b581-761edf88fe77",
"name": "Swagger Petstore",
"uid": "2282-b31be584-1b1e-4444-b581-761edf88fe77"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"details": {
"param": "type"
},
"message": "The request body is missing a value for the type parameter. Check your request and try again.",
"name": "paramMissingError"
}
}
GET
All Mocks
{{baseUrl}}/mocks
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mocks");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/mocks")
require "http/client"
url = "{{baseUrl}}/mocks"
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}}/mocks"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mocks");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mocks"
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/mocks HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/mocks")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mocks"))
.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}}/mocks")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/mocks")
.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}}/mocks');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/mocks'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mocks';
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}}/mocks',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mocks")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/mocks',
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}}/mocks'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/mocks');
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}}/mocks'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mocks';
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}}/mocks"]
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}}/mocks" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mocks",
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}}/mocks');
echo $response->getBody();
setUrl('{{baseUrl}}/mocks');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mocks');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mocks' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mocks' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/mocks")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mocks"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mocks"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mocks")
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/mocks') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mocks";
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}}/mocks
http GET {{baseUrl}}/mocks
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/mocks
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mocks")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"mocks": [
{
"collection": "1679925-39fee52f-b806-3ffa-1173-00a6f5b183dc",
"environment": "1679925-0b9e9f15-3208-a2b1-22e0-d58392f01524",
"id": "0fca2246-c108-41f5-8454-cc032def329f",
"mockUrl": "https://0fca2246-c108-41f5-8454-cc032def329f.mock.pstmn.io",
"owner": "1679925",
"uid": "1679925-0fca2246-c108-41f5-8454-cc032def329f"
},
{
"collection": "1679925-37294bb0-e27b-5e52-93ae-c07dd445216d",
"id": "2c624389-705a-4e66-9777-05314b431796",
"mockUrl": "https://2c624389-705a-4e66-9777-05314b431796.mock.pstmn.io",
"owner": "1679925",
"uid": "1679925-2c624389-705a-4e66-9777-05314b431796"
}
]
}
POST
Create Mock
{{baseUrl}}/mocks
BODY json
{
"mock": {
"collection": "",
"environment": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mocks");
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 \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/mocks" {:content-type :json
:form-params {:mock {:collection ""
:environment ""}}})
require "http/client"
url = "{{baseUrl}}/mocks"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\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}}/mocks"),
Content = new StringContent("{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\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}}/mocks");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mocks"
payload := strings.NewReader("{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\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/mocks HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 63
{
"mock": {
"collection": "",
"environment": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/mocks")
.setHeader("content-type", "application/json")
.setBody("{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mocks"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\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 \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/mocks")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/mocks")
.header("content-type", "application/json")
.body("{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
mock: {
collection: '',
environment: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/mocks');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/mocks',
headers: {'content-type': 'application/json'},
data: {mock: {collection: '', environment: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mocks';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"mock":{"collection":"","environment":""}}'
};
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}}/mocks',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "mock": {\n "collection": "",\n "environment": ""\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 \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/mocks")
.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/mocks',
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({mock: {collection: '', environment: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/mocks',
headers: {'content-type': 'application/json'},
body: {mock: {collection: '', environment: ''}},
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}}/mocks');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
mock: {
collection: '',
environment: ''
}
});
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}}/mocks',
headers: {'content-type': 'application/json'},
data: {mock: {collection: '', environment: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mocks';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"mock":{"collection":"","environment":""}}'
};
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 = @{ @"mock": @{ @"collection": @"", @"environment": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/mocks"]
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}}/mocks" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mocks",
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([
'mock' => [
'collection' => '',
'environment' => ''
]
]),
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}}/mocks', [
'body' => '{
"mock": {
"collection": "",
"environment": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/mocks');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'mock' => [
'collection' => '',
'environment' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'mock' => [
'collection' => '',
'environment' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/mocks');
$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}}/mocks' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"mock": {
"collection": "",
"environment": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mocks' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"mock": {
"collection": "",
"environment": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/mocks", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mocks"
payload = { "mock": {
"collection": "",
"environment": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mocks"
payload <- "{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\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}}/mocks")
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 \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\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/mocks') do |req|
req.body = "{\n \"mock\": {\n \"collection\": \"\",\n \"environment\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mocks";
let payload = json!({"mock": json!({
"collection": "",
"environment": ""
})});
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}}/mocks \
--header 'content-type: application/json' \
--data '{
"mock": {
"collection": "",
"environment": ""
}
}'
echo '{
"mock": {
"collection": "",
"environment": ""
}
}' | \
http POST {{baseUrl}}/mocks \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "mock": {\n "collection": "",\n "environment": ""\n }\n}' \
--output-document \
- {{baseUrl}}/mocks
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["mock": [
"collection": "",
"environment": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mocks")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"mock": {
"collection": "1679925-39fee52f-b806-3ffa-1173-00a6f5b183dc",
"environment": "1679925-0b9e9f15-3208-a2b1-22e0-d58392f01524",
"id": "0fca2246-c108-41f5-8454-cc032def329f",
"mockUrl": "https://0fca2246-c108-41f5-8454-cc032def329f.mock.pstmn.io",
"owner": "1679925",
"uid": "1679925-0fca2246-c108-41f5-8454-cc032def329f"
}
}
DELETE
Delete Mock
{{baseUrl}}/mocks/:mock_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mocks/:mock_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/mocks/:mock_uid")
require "http/client"
url = "{{baseUrl}}/mocks/:mock_uid"
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}}/mocks/:mock_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mocks/:mock_uid");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mocks/:mock_uid"
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/mocks/:mock_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/mocks/:mock_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mocks/:mock_uid"))
.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}}/mocks/:mock_uid")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/mocks/:mock_uid")
.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}}/mocks/:mock_uid');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/mocks/:mock_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mocks/:mock_uid';
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}}/mocks/:mock_uid',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mocks/:mock_uid")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/mocks/:mock_uid',
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}}/mocks/:mock_uid'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/mocks/:mock_uid');
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}}/mocks/:mock_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mocks/:mock_uid';
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}}/mocks/:mock_uid"]
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}}/mocks/:mock_uid" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mocks/:mock_uid",
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}}/mocks/:mock_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/mocks/:mock_uid');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mocks/:mock_uid');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mocks/:mock_uid' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mocks/:mock_uid' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/mocks/:mock_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mocks/:mock_uid"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mocks/:mock_uid"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mocks/:mock_uid")
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/mocks/:mock_uid') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mocks/:mock_uid";
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}}/mocks/:mock_uid
http DELETE {{baseUrl}}/mocks/:mock_uid
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/mocks/:mock_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mocks/:mock_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"mock": {
"id": "0fca2246-c108-41f5-8454-cc032def329f",
"uid": "1679925-0fca2246-c108-41f5-8454-cc032def329f"
}
}
POST
Publish Mock
{{baseUrl}}/mocks/:mock_uid/publish
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mocks/:mock_uid/publish");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/mocks/:mock_uid/publish")
require "http/client"
url = "{{baseUrl}}/mocks/:mock_uid/publish"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/mocks/:mock_uid/publish"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mocks/:mock_uid/publish");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mocks/:mock_uid/publish"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/mocks/:mock_uid/publish HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/mocks/:mock_uid/publish")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mocks/:mock_uid/publish"))
.method("POST", 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}}/mocks/:mock_uid/publish")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/mocks/:mock_uid/publish")
.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('POST', '{{baseUrl}}/mocks/:mock_uid/publish');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/mocks/:mock_uid/publish'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mocks/:mock_uid/publish';
const options = {method: 'POST'};
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}}/mocks/:mock_uid/publish',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mocks/:mock_uid/publish")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/mocks/:mock_uid/publish',
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: 'POST', url: '{{baseUrl}}/mocks/:mock_uid/publish'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/mocks/:mock_uid/publish');
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}}/mocks/:mock_uid/publish'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mocks/:mock_uid/publish';
const options = {method: 'POST'};
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}}/mocks/:mock_uid/publish"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
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}}/mocks/:mock_uid/publish" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mocks/:mock_uid/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/mocks/:mock_uid/publish');
echo $response->getBody();
setUrl('{{baseUrl}}/mocks/:mock_uid/publish');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mocks/:mock_uid/publish');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mocks/:mock_uid/publish' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mocks/:mock_uid/publish' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/mocks/:mock_uid/publish")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mocks/:mock_uid/publish"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mocks/:mock_uid/publish"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mocks/:mock_uid/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/mocks/:mock_uid/publish') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mocks/:mock_uid/publish";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/mocks/:mock_uid/publish
http POST {{baseUrl}}/mocks/:mock_uid/publish
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/mocks/:mock_uid/publish
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mocks/:mock_uid/publish")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"mock": {
"id": "06040138-dd6b-4cce-9a02-7e1c1ab59723"
}
}
GET
Single Mock
{{baseUrl}}/mocks/:mock_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mocks/:mock_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/mocks/:mock_uid")
require "http/client"
url = "{{baseUrl}}/mocks/:mock_uid"
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}}/mocks/:mock_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mocks/:mock_uid");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mocks/:mock_uid"
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/mocks/:mock_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/mocks/:mock_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mocks/:mock_uid"))
.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}}/mocks/:mock_uid")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/mocks/:mock_uid")
.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}}/mocks/:mock_uid');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/mocks/:mock_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mocks/:mock_uid';
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}}/mocks/:mock_uid',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mocks/:mock_uid")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/mocks/:mock_uid',
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}}/mocks/:mock_uid'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/mocks/:mock_uid');
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}}/mocks/:mock_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mocks/:mock_uid';
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}}/mocks/:mock_uid"]
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}}/mocks/:mock_uid" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mocks/:mock_uid",
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}}/mocks/:mock_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/mocks/:mock_uid');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mocks/:mock_uid');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mocks/:mock_uid' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mocks/:mock_uid' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/mocks/:mock_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mocks/:mock_uid"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mocks/:mock_uid"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mocks/:mock_uid")
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/mocks/:mock_uid') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mocks/:mock_uid";
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}}/mocks/:mock_uid
http GET {{baseUrl}}/mocks/:mock_uid
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/mocks/:mock_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mocks/:mock_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"mock": {
"collection": "1679925-39fee52f-b806-3ffa-1173-00a6f5b183dc",
"environment": "1679925-0b9e9f15-3208-a2b1-22e0-d58392f01524",
"id": "0fca2246-c108-41f5-8454-cc032def329f",
"mockUrl": "https://0fca2246-c108-41f5-8454-cc032def329f.mock.pstmn.io",
"owner": "1679925",
"uid": "1679925-0fca2246-c108-41f5-8454-cc032def329f"
}
}
DELETE
Unpublish Mock
{{baseUrl}}/mocks/:mock_uid/unpublish
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mocks/:mock_uid/unpublish");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/mocks/:mock_uid/unpublish")
require "http/client"
url = "{{baseUrl}}/mocks/:mock_uid/unpublish"
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}}/mocks/:mock_uid/unpublish"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mocks/:mock_uid/unpublish");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mocks/:mock_uid/unpublish"
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/mocks/:mock_uid/unpublish HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/mocks/:mock_uid/unpublish")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mocks/:mock_uid/unpublish"))
.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}}/mocks/:mock_uid/unpublish")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/mocks/:mock_uid/unpublish")
.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}}/mocks/:mock_uid/unpublish');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/mocks/:mock_uid/unpublish'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mocks/:mock_uid/unpublish';
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}}/mocks/:mock_uid/unpublish',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mocks/:mock_uid/unpublish")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/mocks/:mock_uid/unpublish',
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}}/mocks/:mock_uid/unpublish'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/mocks/:mock_uid/unpublish');
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}}/mocks/:mock_uid/unpublish'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mocks/:mock_uid/unpublish';
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}}/mocks/:mock_uid/unpublish"]
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}}/mocks/:mock_uid/unpublish" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mocks/:mock_uid/unpublish",
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}}/mocks/:mock_uid/unpublish');
echo $response->getBody();
setUrl('{{baseUrl}}/mocks/:mock_uid/unpublish');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mocks/:mock_uid/unpublish');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mocks/:mock_uid/unpublish' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mocks/:mock_uid/unpublish' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/mocks/:mock_uid/unpublish")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mocks/:mock_uid/unpublish"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mocks/:mock_uid/unpublish"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mocks/:mock_uid/unpublish")
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/mocks/:mock_uid/unpublish') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mocks/:mock_uid/unpublish";
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}}/mocks/:mock_uid/unpublish
http DELETE {{baseUrl}}/mocks/:mock_uid/unpublish
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/mocks/:mock_uid/unpublish
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mocks/:mock_uid/unpublish")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"mock": {
"id": "06040138-dd6b-4cce-9a02-7e1c1ab59723"
}
}
PUT
Update Mock
{{baseUrl}}/mocks/:mock_uid
BODY json
{
"mock": {
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mocks/:mock_uid");
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 \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/mocks/:mock_uid" {:content-type :json
:form-params {:mock {:description ""
:environment ""
:name ""
:private false
:versionTag ""}}})
require "http/client"
url = "{{baseUrl}}/mocks/:mock_uid"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/mocks/:mock_uid"),
Content = new StringContent("{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\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}}/mocks/:mock_uid");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mocks/:mock_uid"
payload := strings.NewReader("{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/mocks/:mock_uid HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 124
{
"mock": {
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/mocks/:mock_uid")
.setHeader("content-type", "application/json")
.setBody("{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mocks/:mock_uid"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\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 \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/mocks/:mock_uid")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/mocks/:mock_uid")
.header("content-type", "application/json")
.body("{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
mock: {
description: '',
environment: '',
name: '',
private: false,
versionTag: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/mocks/:mock_uid');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/mocks/:mock_uid',
headers: {'content-type': 'application/json'},
data: {
mock: {description: '', environment: '', name: '', private: false, versionTag: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mocks/:mock_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"mock":{"description":"","environment":"","name":"","private":false,"versionTag":""}}'
};
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}}/mocks/:mock_uid',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "mock": {\n "description": "",\n "environment": "",\n "name": "",\n "private": false,\n "versionTag": ""\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 \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/mocks/:mock_uid")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/mocks/:mock_uid',
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({
mock: {description: '', environment: '', name: '', private: false, versionTag: ''}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/mocks/:mock_uid',
headers: {'content-type': 'application/json'},
body: {
mock: {description: '', environment: '', name: '', private: false, versionTag: ''}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/mocks/:mock_uid');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
mock: {
description: '',
environment: '',
name: '',
private: false,
versionTag: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/mocks/:mock_uid',
headers: {'content-type': 'application/json'},
data: {
mock: {description: '', environment: '', name: '', private: false, versionTag: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mocks/:mock_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"mock":{"description":"","environment":"","name":"","private":false,"versionTag":""}}'
};
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 = @{ @"mock": @{ @"description": @"", @"environment": @"", @"name": @"", @"private": @NO, @"versionTag": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/mocks/:mock_uid"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/mocks/:mock_uid" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mocks/:mock_uid",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'mock' => [
'description' => '',
'environment' => '',
'name' => '',
'private' => null,
'versionTag' => ''
]
]),
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('PUT', '{{baseUrl}}/mocks/:mock_uid', [
'body' => '{
"mock": {
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/mocks/:mock_uid');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'mock' => [
'description' => '',
'environment' => '',
'name' => '',
'private' => null,
'versionTag' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'mock' => [
'description' => '',
'environment' => '',
'name' => '',
'private' => null,
'versionTag' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/mocks/:mock_uid');
$request->setRequestMethod('PUT');
$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}}/mocks/:mock_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"mock": {
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mocks/:mock_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"mock": {
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/mocks/:mock_uid", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mocks/:mock_uid"
payload = { "mock": {
"description": "",
"environment": "",
"name": "",
"private": False,
"versionTag": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mocks/:mock_uid"
payload <- "{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mocks/:mock_uid")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\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.put('/baseUrl/mocks/:mock_uid') do |req|
req.body = "{\n \"mock\": {\n \"description\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"private\": false,\n \"versionTag\": \"\"\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}}/mocks/:mock_uid";
let payload = json!({"mock": json!({
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/mocks/:mock_uid \
--header 'content-type: application/json' \
--data '{
"mock": {
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
}
}'
echo '{
"mock": {
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
}
}' | \
http PUT {{baseUrl}}/mocks/:mock_uid \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "mock": {\n "description": "",\n "environment": "",\n "name": "",\n "private": false,\n "versionTag": ""\n }\n}' \
--output-document \
- {{baseUrl}}/mocks/:mock_uid
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["mock": [
"description": "",
"environment": "",
"name": "",
"private": false,
"versionTag": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mocks/:mock_uid")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"mock": {
"collection": "11582779-fd6797e2-de6b-4699-975c-85290e4c2499",
"config": {
"headers": [],
"matchBody": false,
"matchQueryParams": true,
"matchWildcards": true
},
"environment": "11582779-ac1b6608-deb7-4c05-9d48-ee775aabfc19",
"id": "06040138-dd6b-4cce-9a02-7e1c1ab59723",
"mockUrl": "https://06040138-dd6b-4cce-9a02-7e1c1ab59723.mock.pstmn.io",
"name": "My Mock Server",
"owner": "11582779",
"uid": "11582779-06040138-dd6b-4cce-9a02-7e1c1ab59723"
}
}
GET
All Monitors
{{baseUrl}}/monitors
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/monitors");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/monitors")
require "http/client"
url = "{{baseUrl}}/monitors"
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}}/monitors"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/monitors");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/monitors"
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/monitors HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/monitors")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/monitors"))
.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}}/monitors")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/monitors")
.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}}/monitors');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/monitors'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/monitors';
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}}/monitors',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/monitors")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/monitors',
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}}/monitors'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/monitors');
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}}/monitors'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/monitors';
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}}/monitors"]
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}}/monitors" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/monitors",
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}}/monitors');
echo $response->getBody();
setUrl('{{baseUrl}}/monitors');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/monitors');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/monitors' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/monitors' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/monitors")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/monitors"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/monitors"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/monitors")
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/monitors') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/monitors";
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}}/monitors
http GET {{baseUrl}}/monitors
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/monitors
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/monitors")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"monitors": [
{
"id": "1e6b6c77-2031-42d0-9948-76d7251b2dd1",
"name": "Batman & Sherlock Holmes Monitor",
"owner": "5852",
"uid": "5852-1e6b6c77-2031-42d0-9948-76d7251b2dd1"
},
{
"id": "1e6b6cb7-f13d-4000-acb7-0695757174a8",
"name": "Team Level Monitor",
"owner": "5886",
"uid": "5886-1e6b6cb7-f13d-4000-acb7-0695757174a8"
},
{
"id": "1e6b6cc1-c760-48e0-968f-4bfaeeae9af1",
"name": "Postman Echo Monitor",
"owner": "5852",
"uid": "5852-1e6b6cc1-c760-48e0-968f-4bfaeeae9af1"
}
]
}
POST
Create Monitor
{{baseUrl}}/monitors
BODY json
{
"monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/monitors");
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 \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/monitors" {:content-type :json
:form-params {:monitor {:collection ""
:environment ""
:name ""
:schedule {:cron ""
:timezone ""}}}})
require "http/client"
url = "{{baseUrl}}/monitors"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/monitors"),
Content = new StringContent("{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/monitors");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/monitors"
payload := strings.NewReader("{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/monitors HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 146
{
"monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/monitors")
.setHeader("content-type", "application/json")
.setBody("{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/monitors"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/monitors")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/monitors")
.header("content-type", "application/json")
.body("{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
monitor: {
collection: '',
environment: '',
name: '',
schedule: {
cron: '',
timezone: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/monitors');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/monitors',
headers: {'content-type': 'application/json'},
data: {
monitor: {collection: '', environment: '', name: '', schedule: {cron: '', timezone: ''}}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/monitors';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"monitor":{"collection":"","environment":"","name":"","schedule":{"cron":"","timezone":""}}}'
};
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}}/monitors',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "monitor": {\n "collection": "",\n "environment": "",\n "name": "",\n "schedule": {\n "cron": "",\n "timezone": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/monitors")
.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/monitors',
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({
monitor: {collection: '', environment: '', name: '', schedule: {cron: '', timezone: ''}}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/monitors',
headers: {'content-type': 'application/json'},
body: {
monitor: {collection: '', environment: '', name: '', schedule: {cron: '', timezone: ''}}
},
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}}/monitors');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
monitor: {
collection: '',
environment: '',
name: '',
schedule: {
cron: '',
timezone: ''
}
}
});
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}}/monitors',
headers: {'content-type': 'application/json'},
data: {
monitor: {collection: '', environment: '', name: '', schedule: {cron: '', timezone: ''}}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/monitors';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"monitor":{"collection":"","environment":"","name":"","schedule":{"cron":"","timezone":""}}}'
};
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 = @{ @"monitor": @{ @"collection": @"", @"environment": @"", @"name": @"", @"schedule": @{ @"cron": @"", @"timezone": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/monitors"]
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}}/monitors" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/monitors",
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([
'monitor' => [
'collection' => '',
'environment' => '',
'name' => '',
'schedule' => [
'cron' => '',
'timezone' => ''
]
]
]),
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}}/monitors', [
'body' => '{
"monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/monitors');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'monitor' => [
'collection' => '',
'environment' => '',
'name' => '',
'schedule' => [
'cron' => '',
'timezone' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'monitor' => [
'collection' => '',
'environment' => '',
'name' => '',
'schedule' => [
'cron' => '',
'timezone' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/monitors');
$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}}/monitors' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/monitors' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/monitors", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/monitors"
payload = { "monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/monitors"
payload <- "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/monitors")
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 \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/monitors') do |req|
req.body = "{\n \"monitor\": {\n \"collection\": \"\",\n \"environment\": \"\",\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/monitors";
let payload = json!({"monitor": json!({
"collection": "",
"environment": "",
"name": "",
"schedule": json!({
"cron": "",
"timezone": ""
})
})});
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}}/monitors \
--header 'content-type: application/json' \
--data '{
"monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}'
echo '{
"monitor": {
"collection": "",
"environment": "",
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}' | \
http POST {{baseUrl}}/monitors \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "monitor": {\n "collection": "",\n "environment": "",\n "name": "",\n "schedule": {\n "cron": "",\n "timezone": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/monitors
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["monitor": [
"collection": "",
"environment": "",
"name": "",
"schedule": [
"cron": "",
"timezone": ""
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/monitors")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"monitor": {
"id": "1e6b6dfd-7ba4-4590-9ee1-5948102d7797",
"name": "Monitor Name",
"uid": "5852-1e6b6dfd-7ba4-4590-9ee1-5948102d7797"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"details": {
"param": "monitor"
},
"message": "Parameter is missing in the request.",
"name": "paramMissingError"
}
}
DELETE
Delete Monitor
{{baseUrl}}/monitors/:monitor_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/monitors/:monitor_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/monitors/:monitor_uid")
require "http/client"
url = "{{baseUrl}}/monitors/:monitor_uid"
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}}/monitors/:monitor_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/monitors/:monitor_uid");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/monitors/:monitor_uid"
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/monitors/:monitor_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/monitors/:monitor_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/monitors/:monitor_uid"))
.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}}/monitors/:monitor_uid")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/monitors/:monitor_uid")
.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}}/monitors/:monitor_uid');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/monitors/:monitor_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/monitors/:monitor_uid';
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}}/monitors/:monitor_uid',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/monitors/:monitor_uid")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/monitors/:monitor_uid',
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}}/monitors/:monitor_uid'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/monitors/:monitor_uid');
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}}/monitors/:monitor_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/monitors/:monitor_uid';
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}}/monitors/:monitor_uid"]
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}}/monitors/:monitor_uid" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/monitors/:monitor_uid",
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}}/monitors/:monitor_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/monitors/:monitor_uid');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/monitors/:monitor_uid');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/monitors/:monitor_uid' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/monitors/:monitor_uid' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/monitors/:monitor_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/monitors/:monitor_uid"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/monitors/:monitor_uid"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/monitors/:monitor_uid")
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/monitors/:monitor_uid') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/monitors/:monitor_uid";
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}}/monitors/:monitor_uid
http DELETE {{baseUrl}}/monitors/:monitor_uid
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/monitors/:monitor_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/monitors/:monitor_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"monitor": {
"id": "1e6b8957-35f9-42a0-8d2f-f03d7085b3d2",
"uid": "5852-1e6b8957-35f9-42a0-8d2f-f03d7085b3d2"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "The specified monitor does not exist.",
"name": "instanceNotFoundError"
}
}
POST
Run a Monitor
{{baseUrl}}/monitors/:monitor_uid/run
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/monitors/:monitor_uid/run");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/monitors/:monitor_uid/run")
require "http/client"
url = "{{baseUrl}}/monitors/:monitor_uid/run"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/monitors/:monitor_uid/run"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/monitors/:monitor_uid/run");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/monitors/:monitor_uid/run"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/monitors/:monitor_uid/run HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/monitors/:monitor_uid/run")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/monitors/:monitor_uid/run"))
.method("POST", 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}}/monitors/:monitor_uid/run")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/monitors/:monitor_uid/run")
.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('POST', '{{baseUrl}}/monitors/:monitor_uid/run');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/monitors/:monitor_uid/run'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/monitors/:monitor_uid/run';
const options = {method: 'POST'};
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}}/monitors/:monitor_uid/run',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/monitors/:monitor_uid/run")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/monitors/:monitor_uid/run',
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: 'POST', url: '{{baseUrl}}/monitors/:monitor_uid/run'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/monitors/:monitor_uid/run');
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}}/monitors/:monitor_uid/run'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/monitors/:monitor_uid/run';
const options = {method: 'POST'};
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}}/monitors/:monitor_uid/run"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
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}}/monitors/:monitor_uid/run" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/monitors/:monitor_uid/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/monitors/:monitor_uid/run');
echo $response->getBody();
setUrl('{{baseUrl}}/monitors/:monitor_uid/run');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/monitors/:monitor_uid/run');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/monitors/:monitor_uid/run' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/monitors/:monitor_uid/run' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/monitors/:monitor_uid/run")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/monitors/:monitor_uid/run"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/monitors/:monitor_uid/run"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/monitors/:monitor_uid/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/monitors/:monitor_uid/run') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/monitors/:monitor_uid/run";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/monitors/:monitor_uid/run
http POST {{baseUrl}}/monitors/:monitor_uid/run
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/monitors/:monitor_uid/run
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/monitors/:monitor_uid/run")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"run": {
"executions": [
{
"id": 1,
"item": {
"id": "b5e8d7dd-909c-4ba7-aef4-8609bc50b586",
"name": "Sample POST Request"
},
"request": {
"body": {
"contentLength": 18,
"mode": "raw"
},
"headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"content-length": 18,
"content-type": "application/json"
},
"method": "POST",
"timestamp": "2016-12-04T14:30:26.025Z",
"url": "echo.getpostman.com/post"
},
"response": {
"body": {
"contentLength": 298
},
"code": 200,
"headers": {
"connection": "keep-alive",
"content-encoding": "gzip",
"content-type": "application/json",
"date": "Sun, 04 Dec 2016 14:30:26 GMT",
"transfer-encoding": "chunked"
},
"responseSize": 298,
"responseTime": 26
}
},
{
"assertions": {
"Status code is 400": false
},
"id": 2,
"item": {
"id": "f790d046-755d-44f5-a416-b825e18dfd9d",
"name": "Sample GET Request"
},
"request": {
"body": {
"contentLength": 0,
"mode": "formdata"
},
"headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate"
},
"method": "GET",
"timestamp": "2016-12-04T14:30:26.093Z",
"url": "echo.getpostman.com/get"
},
"response": {
"body": {
"contentLength": 280
},
"code": 200,
"headers": {
"connection": "keep-alive",
"content-encoding": "gzip",
"content-type": "application/json",
"date": "Sun, 04 Dec 2016 14:30:26 GMT",
"transfer-encoding": "chunked"
},
"responseSize": 280,
"responseTime": 46
}
},
{
"id": 3,
"item": {
"id": "336e6e17-6d3e-4b8f-a48f-b7e75cf13afb",
"name": "This is the second request"
},
"request": {
"body": {
"contentLength": 0,
"mode": "formdata"
},
"headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"content-length": 18
},
"method": "POST",
"timestamp": "2016-12-04T14:30:26.477Z",
"url": "echo.getpostman.com/post"
},
"response": {
"body": {
"contentLength": 345
},
"code": 200,
"headers": {
"connection": "keep-alive",
"content-encoding": "gzip",
"content-type": "application/json",
"date": "Sun, 04 Dec 2016 14:30:26 GMT",
"transfer-encoding": "chunked"
},
"responseSize": 345,
"responseTime": 9
}
}
],
"failures": [
{
"assertion": {
"Status code is 400": false
},
"executionId": 2,
"message": "Expected 'Status code is 400' to be truthy",
"name": "AssertionError"
}
],
"info": {
"collectionUid": "5852-1d3daef4-2037-4584-ab86-bafd8c8f8a55",
"finishedAt": "2016-12-04T14:30:26.000Z",
"jobId": "1e6ba2e3-1aaf-4c10-bd5f-905943284b2a",
"monitorId": "1e6b8970-fd13-4480-b011-b3b3e3cd271d",
"name": "Sample Collection monitor 1 #56",
"startedAt": "2016-12-04T14:30:25.000Z",
"status": "failed"
},
"stats": {
"assertions": {
"failed": 1,
"total": 1
},
"requests": {
"failed": 1,
"total": 3
}
}
}
}
GET
Single Monitor
{{baseUrl}}/monitors/:monitor_uid
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/monitors/:monitor_uid");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/monitors/:monitor_uid")
require "http/client"
url = "{{baseUrl}}/monitors/:monitor_uid"
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}}/monitors/:monitor_uid"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/monitors/:monitor_uid");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/monitors/:monitor_uid"
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/monitors/:monitor_uid HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/monitors/:monitor_uid")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/monitors/:monitor_uid"))
.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}}/monitors/:monitor_uid")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/monitors/:monitor_uid")
.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}}/monitors/:monitor_uid');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/monitors/:monitor_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/monitors/:monitor_uid';
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}}/monitors/:monitor_uid',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/monitors/:monitor_uid")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/monitors/:monitor_uid',
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}}/monitors/:monitor_uid'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/monitors/:monitor_uid');
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}}/monitors/:monitor_uid'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/monitors/:monitor_uid';
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}}/monitors/:monitor_uid"]
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}}/monitors/:monitor_uid" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/monitors/:monitor_uid",
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}}/monitors/:monitor_uid');
echo $response->getBody();
setUrl('{{baseUrl}}/monitors/:monitor_uid');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/monitors/:monitor_uid');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/monitors/:monitor_uid' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/monitors/:monitor_uid' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/monitors/:monitor_uid")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/monitors/:monitor_uid"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/monitors/:monitor_uid"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/monitors/:monitor_uid")
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/monitors/:monitor_uid') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/monitors/:monitor_uid";
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}}/monitors/:monitor_uid
http GET {{baseUrl}}/monitors/:monitor_uid
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/monitors/:monitor_uid
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/monitors/:monitor_uid")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"monitor": {
"collectionUid": "5852-8d05dd85-222c-1452-553b-e76a531b71ed",
"distribution": [],
"environmentUid": "5851-8d05dd85-222c-1452-553b-e76a531b71ed",
"id": "1e6b6cc1-c760-48e0-968f-4bfaeeae9af1",
"lastRun": {
"finishedAt": "2020-03-25T15:45:31.340Z",
"startedAt": "2020-03-25T15:45:29.218Z",
"stats": {
"assertions": {
"failed": 1,
"total": 8
},
"requests": {
"total": 4
}
},
"status": "failed"
},
"name": "Postman Echo Monitor",
"notifications": {
"onError": [
{
"email": "john.appleseed@example.com"
}
],
"onFailure": [
{
"email": "john.appleseed@example.com"
}
]
},
"options": {
"followRedirects": true,
"requestDelay": 0,
"requestTimeout": 3000,
"strictSSL": true
},
"owner": "5852",
"schedule": {
"cron": "0 0 * * * *",
"nextRun": "2016-11-30T09:30:00.000Z",
"timezone": "Asia/Calcutta"
},
"uid": "5852-1e6b6cc1-c760-48e0-968f-4bfaeeae9af1"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "The specified monitor does not exist.",
"name": "instanceNotFoundError"
}
}
PUT
Update Monitor
{{baseUrl}}/monitors/:monitor_uid
BODY json
{
"monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/monitors/:monitor_uid");
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 \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/monitors/:monitor_uid" {:content-type :json
:form-params {:monitor {:name ""
:schedule {:cron ""
:timezone ""}}}})
require "http/client"
url = "{{baseUrl}}/monitors/:monitor_uid"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/monitors/:monitor_uid"),
Content = new StringContent("{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/monitors/:monitor_uid");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/monitors/:monitor_uid"
payload := strings.NewReader("{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/monitors/:monitor_uid HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 101
{
"monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/monitors/:monitor_uid")
.setHeader("content-type", "application/json")
.setBody("{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/monitors/:monitor_uid"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/monitors/:monitor_uid")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/monitors/:monitor_uid")
.header("content-type", "application/json")
.body("{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
monitor: {
name: '',
schedule: {
cron: '',
timezone: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/monitors/:monitor_uid');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/monitors/:monitor_uid',
headers: {'content-type': 'application/json'},
data: {monitor: {name: '', schedule: {cron: '', timezone: ''}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/monitors/:monitor_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"monitor":{"name":"","schedule":{"cron":"","timezone":""}}}'
};
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}}/monitors/:monitor_uid',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "monitor": {\n "name": "",\n "schedule": {\n "cron": "",\n "timezone": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/monitors/:monitor_uid")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/monitors/:monitor_uid',
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({monitor: {name: '', schedule: {cron: '', timezone: ''}}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/monitors/:monitor_uid',
headers: {'content-type': 'application/json'},
body: {monitor: {name: '', schedule: {cron: '', timezone: ''}}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/monitors/:monitor_uid');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
monitor: {
name: '',
schedule: {
cron: '',
timezone: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/monitors/:monitor_uid',
headers: {'content-type': 'application/json'},
data: {monitor: {name: '', schedule: {cron: '', timezone: ''}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/monitors/:monitor_uid';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"monitor":{"name":"","schedule":{"cron":"","timezone":""}}}'
};
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 = @{ @"monitor": @{ @"name": @"", @"schedule": @{ @"cron": @"", @"timezone": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/monitors/:monitor_uid"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/monitors/:monitor_uid" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/monitors/:monitor_uid",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'monitor' => [
'name' => '',
'schedule' => [
'cron' => '',
'timezone' => ''
]
]
]),
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('PUT', '{{baseUrl}}/monitors/:monitor_uid', [
'body' => '{
"monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/monitors/:monitor_uid');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'monitor' => [
'name' => '',
'schedule' => [
'cron' => '',
'timezone' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'monitor' => [
'name' => '',
'schedule' => [
'cron' => '',
'timezone' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/monitors/:monitor_uid');
$request->setRequestMethod('PUT');
$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}}/monitors/:monitor_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/monitors/:monitor_uid' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/monitors/:monitor_uid", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/monitors/:monitor_uid"
payload = { "monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/monitors/:monitor_uid"
payload <- "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/monitors/:monitor_uid")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/monitors/:monitor_uid') do |req|
req.body = "{\n \"monitor\": {\n \"name\": \"\",\n \"schedule\": {\n \"cron\": \"\",\n \"timezone\": \"\"\n }\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}}/monitors/:monitor_uid";
let payload = json!({"monitor": json!({
"name": "",
"schedule": json!({
"cron": "",
"timezone": ""
})
})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/monitors/:monitor_uid \
--header 'content-type: application/json' \
--data '{
"monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}'
echo '{
"monitor": {
"name": "",
"schedule": {
"cron": "",
"timezone": ""
}
}
}' | \
http PUT {{baseUrl}}/monitors/:monitor_uid \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "monitor": {\n "name": "",\n "schedule": {\n "cron": "",\n "timezone": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/monitors/:monitor_uid
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["monitor": [
"name": "",
"schedule": [
"cron": "",
"timezone": ""
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/monitors/:monitor_uid")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"monitor": {
"id": "1e6b6e2a-c2ad-4090-b750-0df4e6624352",
"name": "Updated Monitor Name",
"uid": "5852-1e6b6e2a-c2ad-4090-b750-0df4e6624352"
}
}
GET
API Key Owner
{{baseUrl}}/me
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/me");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/me")
require "http/client"
url = "{{baseUrl}}/me"
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}}/me"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/me");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/me"
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/me HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/me")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/me"))
.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}}/me")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/me")
.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}}/me');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/me'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/me';
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}}/me',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/me")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/me',
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}}/me'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/me');
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}}/me'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/me';
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}}/me"]
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}}/me" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/me",
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}}/me');
echo $response->getBody();
setUrl('{{baseUrl}}/me');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/me');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/me' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/me' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/me")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/me"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/me"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/me")
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/me') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/me";
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}}/me
http GET {{baseUrl}}/me
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/me
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/me")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"operations": [
{
"limit": 1000000,
"name": "mock_usage",
"overage": 0,
"usage": 2382
},
{
"limit": 10000000,
"name": "monitor_request_runs",
"overage": 0,
"usage": 49492
},
{
"limit": 5000000,
"name": "documenter_public_views",
"overage": 0,
"usage": 120232
},
{
"limit": 1000000,
"name": "api_usage",
"overage": 0,
"usage": 1345
},
{
"limit": 25,
"name": "custom_domains",
"overage": 0,
"usage": 1
},
{
"limit": 1,
"name": "custom_authentication_methods",
"overage": 0,
"usage": 1
},
{
"limit": 10000,
"name": "serverless_requests",
"overage": 0,
"usage": 0
},
{
"limit": 5000,
"name": "integrations",
"overage": 0,
"usage": 145
},
{
"limit": 1000000,
"name": "cloud_agent_requests",
"overage": 0,
"usage": 23823
}
],
"user": {
"avatar": "https://www.gravatar.com/avatar/e1f3994f2632af3d1c8c2dcc168a10e6",
"email": "janedoe@example.com",
"fullName": "Jane Doe",
"id": "631643",
"isPublic": false,
"username": "janedoe"
}
}
POST
Create Webhook
{{baseUrl}}/webhooks
BODY json
{
"webhook": {
"collection": "",
"name": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/webhooks");
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 \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/webhooks" {:content-type :json
:form-params {:webhook {:collection "{{collection_id}}"
:name "{{webhook_name}}"}}})
require "http/client"
url = "{{baseUrl}}/webhooks"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\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}}/webhooks"),
Content = new StringContent("{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\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}}/webhooks");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/webhooks"
payload := strings.NewReader("{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\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/webhooks HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 92
{
"webhook": {
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/webhooks")
.setHeader("content-type", "application/json")
.setBody("{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/webhooks"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\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 \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/webhooks")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/webhooks")
.header("content-type", "application/json")
.body("{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}")
.asString();
const data = JSON.stringify({
webhook: {
collection: '{{collection_id}}',
name: '{{webhook_name}}'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/webhooks');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/webhooks',
headers: {'content-type': 'application/json'},
data: {webhook: {collection: '{{collection_id}}', name: '{{webhook_name}}'}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/webhooks';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"webhook":{"collection":"{{collection_id}}","name":"{{webhook_name}}"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/webhooks',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "webhook": {\n "collection": "{{collection_id}}",\n "name": "{{webhook_name}}"\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 \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/webhooks")
.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/webhooks',
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({webhook: {collection: '{{collection_id}}', name: '{{webhook_name}}'}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/webhooks',
headers: {'content-type': 'application/json'},
body: {webhook: {collection: '{{collection_id}}', name: '{{webhook_name}}'}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/webhooks');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
webhook: {
collection: '{{collection_id}}',
name: '{{webhook_name}}'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/webhooks',
headers: {'content-type': 'application/json'},
data: {webhook: {collection: '{{collection_id}}', name: '{{webhook_name}}'}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/webhooks';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"webhook":{"collection":"{{collection_id}}","name":"{{webhook_name}}"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"webhook": @{ @"collection": @"{{collection_id}}", @"name": @"{{webhook_name}}" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/webhooks"]
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}}/webhooks" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/webhooks",
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([
'webhook' => [
'collection' => '{{collection_id}}',
'name' => '{{webhook_name}}'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/webhooks', [
'body' => '{
"webhook": {
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/webhooks');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'webhook' => [
'collection' => '{{collection_id}}',
'name' => '{{webhook_name}}'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'webhook' => [
'collection' => '{{collection_id}}',
'name' => '{{webhook_name}}'
]
]));
$request->setRequestUrl('{{baseUrl}}/webhooks');
$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}}/webhooks' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"webhook": {
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/webhooks' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"webhook": {
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/webhooks", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/webhooks"
payload = { "webhook": {
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/webhooks"
payload <- "{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\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}}/webhooks")
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 \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\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/webhooks') do |req|
req.body = "{\n \"webhook\": {\n \"collection\": \"{{collection_id}}\",\n \"name\": \"{{webhook_name}}\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/webhooks";
let payload = json!({"webhook": json!({
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/webhooks \
--header 'content-type: application/json' \
--data '{
"webhook": {
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
}
}'
echo '{
"webhook": {
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
}
}' | \
http POST {{baseUrl}}/webhooks \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "webhook": {\n "collection": "{{collection_id}}",\n "name": "{{webhook_name}}"\n }\n}' \
--output-document \
- {{baseUrl}}/webhooks
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["webhook": [
"collection": "{{collection_id}}",
"name": "{{webhook_name}}"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/webhooks")! 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
All workspaces
{{baseUrl}}/workspaces
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/workspaces");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/workspaces")
require "http/client"
url = "{{baseUrl}}/workspaces"
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}}/workspaces"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/workspaces");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/workspaces"
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/workspaces HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/workspaces")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/workspaces"))
.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}}/workspaces")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/workspaces")
.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}}/workspaces');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/workspaces'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/workspaces';
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}}/workspaces',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/workspaces")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/workspaces',
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}}/workspaces'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/workspaces');
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}}/workspaces'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/workspaces';
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}}/workspaces"]
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}}/workspaces" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/workspaces",
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}}/workspaces');
echo $response->getBody();
setUrl('{{baseUrl}}/workspaces');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/workspaces');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/workspaces' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/workspaces' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/workspaces")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/workspaces"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/workspaces"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/workspaces")
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/workspaces') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/workspaces";
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}}/workspaces
http GET {{baseUrl}}/workspaces
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/workspaces
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/workspaces")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"workspaces": [
{
"id": "4e6d34c2-cfdb-4b33-8868-12a875bebda3",
"name": "My Workspace",
"type": "personal"
},
{
"id": "f8801e9e-03a4-4c7b-b31e-5db5cd771696",
"name": "Team workspace",
"type": "team"
}
]
}
POST
Create Workspace
{{baseUrl}}/workspaces
BODY json
{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": "",
"type": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/workspaces");
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 \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/workspaces" {:content-type :json
:form-params {:workspace {:collections [{:id ""
:name ""
:uid ""}]
:description ""
:environments [{:id ""
:name ""
:uid ""}]
:mocks [{:id ""}]
:monitors [{:id ""}]
:name ""
:type ""}}})
require "http/client"
url = "{{baseUrl}}/workspaces"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\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}}/workspaces"),
Content = new StringContent("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\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}}/workspaces");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/workspaces"
payload := strings.NewReader("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\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/workspaces HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 392
{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": "",
"type": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/workspaces")
.setHeader("content-type", "application/json")
.setBody("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/workspaces"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\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 \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/workspaces")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/workspaces")
.header("content-type", "application/json")
.body("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
workspace: {
collections: [
{
id: '',
name: '',
uid: ''
}
],
description: '',
environments: [
{
id: '',
name: '',
uid: ''
}
],
mocks: [
{
id: ''
}
],
monitors: [
{
id: ''
}
],
name: '',
type: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/workspaces');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/workspaces',
headers: {'content-type': 'application/json'},
data: {
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: '',
type: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/workspaces';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"workspace":{"collections":[{"id":"","name":"","uid":""}],"description":"","environments":[{"id":"","name":"","uid":""}],"mocks":[{"id":""}],"monitors":[{"id":""}],"name":"","type":""}}'
};
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}}/workspaces',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "workspace": {\n "collections": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "description": "",\n "environments": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "mocks": [\n {\n "id": ""\n }\n ],\n "monitors": [\n {\n "id": ""\n }\n ],\n "name": "",\n "type": ""\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 \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/workspaces")
.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/workspaces',
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({
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: '',
type: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/workspaces',
headers: {'content-type': 'application/json'},
body: {
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: '',
type: ''
}
},
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}}/workspaces');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
workspace: {
collections: [
{
id: '',
name: '',
uid: ''
}
],
description: '',
environments: [
{
id: '',
name: '',
uid: ''
}
],
mocks: [
{
id: ''
}
],
monitors: [
{
id: ''
}
],
name: '',
type: ''
}
});
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}}/workspaces',
headers: {'content-type': 'application/json'},
data: {
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: '',
type: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/workspaces';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"workspace":{"collections":[{"id":"","name":"","uid":""}],"description":"","environments":[{"id":"","name":"","uid":""}],"mocks":[{"id":""}],"monitors":[{"id":""}],"name":"","type":""}}'
};
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 = @{ @"workspace": @{ @"collections": @[ @{ @"id": @"", @"name": @"", @"uid": @"" } ], @"description": @"", @"environments": @[ @{ @"id": @"", @"name": @"", @"uid": @"" } ], @"mocks": @[ @{ @"id": @"" } ], @"monitors": @[ @{ @"id": @"" } ], @"name": @"", @"type": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/workspaces"]
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}}/workspaces" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/workspaces",
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([
'workspace' => [
'collections' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'description' => '',
'environments' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'mocks' => [
[
'id' => ''
]
],
'monitors' => [
[
'id' => ''
]
],
'name' => '',
'type' => ''
]
]),
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}}/workspaces', [
'body' => '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": "",
"type": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/workspaces');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'workspace' => [
'collections' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'description' => '',
'environments' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'mocks' => [
[
'id' => ''
]
],
'monitors' => [
[
'id' => ''
]
],
'name' => '',
'type' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'workspace' => [
'collections' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'description' => '',
'environments' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'mocks' => [
[
'id' => ''
]
],
'monitors' => [
[
'id' => ''
]
],
'name' => '',
'type' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/workspaces');
$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}}/workspaces' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": "",
"type": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/workspaces' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": "",
"type": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/workspaces", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/workspaces"
payload = { "workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [{ "id": "" }],
"monitors": [{ "id": "" }],
"name": "",
"type": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/workspaces"
payload <- "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\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}}/workspaces")
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 \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\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/workspaces') do |req|
req.body = "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/workspaces";
let payload = json!({"workspace": json!({
"collections": (
json!({
"id": "",
"name": "",
"uid": ""
})
),
"description": "",
"environments": (
json!({
"id": "",
"name": "",
"uid": ""
})
),
"mocks": (json!({"id": ""})),
"monitors": (json!({"id": ""})),
"name": "",
"type": ""
})});
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}}/workspaces \
--header 'content-type: application/json' \
--data '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": "",
"type": ""
}
}'
echo '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": "",
"type": ""
}
}' | \
http POST {{baseUrl}}/workspaces \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "workspace": {\n "collections": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "description": "",\n "environments": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "mocks": [\n {\n "id": ""\n }\n ],\n "monitors": [\n {\n "id": ""\n }\n ],\n "name": "",\n "type": ""\n }\n}' \
--output-document \
- {{baseUrl}}/workspaces
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["workspace": [
"collections": [
[
"id": "",
"name": "",
"uid": ""
]
],
"description": "",
"environments": [
[
"id": "",
"name": "",
"uid": ""
]
],
"mocks": [["id": ""]],
"monitors": [["id": ""]],
"name": "",
"type": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/workspaces")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"workspace": {
"id": "cfbcd9bf-cc8b-4d6f-b8ef-440a3e49e29f",
"name": "New Workspace"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "Instance not found in the database.",
"name": "instanceNotFoundError"
}
}
DELETE
Delete Workspace
{{baseUrl}}/workspaces/:workspace_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/workspaces/:workspace_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/workspaces/:workspace_id")
require "http/client"
url = "{{baseUrl}}/workspaces/:workspace_id"
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}}/workspaces/:workspace_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/workspaces/:workspace_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/workspaces/:workspace_id"
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/workspaces/:workspace_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/workspaces/:workspace_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/workspaces/:workspace_id"))
.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}}/workspaces/:workspace_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/workspaces/:workspace_id")
.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}}/workspaces/:workspace_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/workspaces/:workspace_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/workspaces/:workspace_id';
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}}/workspaces/:workspace_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/workspaces/:workspace_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/workspaces/:workspace_id',
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}}/workspaces/:workspace_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/workspaces/:workspace_id');
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}}/workspaces/:workspace_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/workspaces/:workspace_id';
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}}/workspaces/:workspace_id"]
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}}/workspaces/:workspace_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/workspaces/:workspace_id",
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}}/workspaces/:workspace_id');
echo $response->getBody();
setUrl('{{baseUrl}}/workspaces/:workspace_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/workspaces/:workspace_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/workspaces/:workspace_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/workspaces/:workspace_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/workspaces/:workspace_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/workspaces/:workspace_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/workspaces/:workspace_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/workspaces/:workspace_id")
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/workspaces/:workspace_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/workspaces/:workspace_id";
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}}/workspaces/:workspace_id
http DELETE {{baseUrl}}/workspaces/:workspace_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/workspaces/:workspace_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/workspaces/:workspace_id")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"workspace": {
"id": "{{workspace_id}}"
}
}
GET
Single workspace
{{baseUrl}}/workspaces/:workspace_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/workspaces/:workspace_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/workspaces/:workspace_id")
require "http/client"
url = "{{baseUrl}}/workspaces/:workspace_id"
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}}/workspaces/:workspace_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/workspaces/:workspace_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/workspaces/:workspace_id"
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/workspaces/:workspace_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/workspaces/:workspace_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/workspaces/:workspace_id"))
.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}}/workspaces/:workspace_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/workspaces/:workspace_id")
.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}}/workspaces/:workspace_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/workspaces/:workspace_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/workspaces/:workspace_id';
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}}/workspaces/:workspace_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/workspaces/:workspace_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/workspaces/:workspace_id',
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}}/workspaces/:workspace_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/workspaces/:workspace_id');
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}}/workspaces/:workspace_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/workspaces/:workspace_id';
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}}/workspaces/:workspace_id"]
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}}/workspaces/:workspace_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/workspaces/:workspace_id",
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}}/workspaces/:workspace_id');
echo $response->getBody();
setUrl('{{baseUrl}}/workspaces/:workspace_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/workspaces/:workspace_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/workspaces/:workspace_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/workspaces/:workspace_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/workspaces/:workspace_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/workspaces/:workspace_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/workspaces/:workspace_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/workspaces/:workspace_id")
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/workspaces/:workspace_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/workspaces/:workspace_id";
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}}/workspaces/:workspace_id
http GET {{baseUrl}}/workspaces/:workspace_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/workspaces/:workspace_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/workspaces/:workspace_id")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"workspace": {
"collections": [
{
"id": "7c31b469-bd43-4411-9283-6d397855ee0e",
"name": "Mock demo - collection",
"uid": "1234-7c31b469-bd43-4411-9283-6d397855ee0e"
},
{
"id": "356fe068-a0f8-4f31-b34d-d12149eac681",
"name": "Mock demo - response code",
"uid": "1234-356fe068-a0f8-4f31-b34d-d12149eac681"
}
],
"description": "Demos.",
"environments": [
{
"id": "423fd955-a9c8-47cd-9ab0-09a6a575c4be",
"name": "Mock demo - CNX",
"uid": "1234-423fd955-a9c8-47cd-9ab0-09a6a575c4be"
},
{
"id": "24c45c84-5147-4c15-bb9a-c3186b81d3cc",
"name": "Mock Demo - response code",
"uid": "1234-24c45c84-5147-4c15-bb9a-c3186b81d3cc"
}
],
"id": "f8801e9e-03a4-4c7b-b31e-5db5cd771696",
"name": "Demo workspace",
"type": "personal"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "Instance not found in the database.",
"name": "instanceNotFoundError"
}
}
PUT
Update Workspace
{{baseUrl}}/workspaces/:workspace_id
BODY json
{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/workspaces/:workspace_id");
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 \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/workspaces/:workspace_id" {:content-type :json
:form-params {:workspace {:collections [{:id ""
:name ""
:uid ""}]
:description ""
:environments [{:id ""
:name ""
:uid ""}]
:mocks [{:id ""}]
:monitors [{:id ""}]
:name ""}}})
require "http/client"
url = "{{baseUrl}}/workspaces/:workspace_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/workspaces/:workspace_id"),
Content = new StringContent("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\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}}/workspaces/:workspace_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/workspaces/:workspace_id"
payload := strings.NewReader("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}
PUT /baseUrl/workspaces/:workspace_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 376
{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/workspaces/:workspace_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/workspaces/:workspace_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\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 \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/workspaces/:workspace_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/workspaces/:workspace_id")
.header("content-type", "application/json")
.body("{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
workspace: {
collections: [
{
id: '',
name: '',
uid: ''
}
],
description: '',
environments: [
{
id: '',
name: '',
uid: ''
}
],
mocks: [
{
id: ''
}
],
monitors: [
{
id: ''
}
],
name: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/workspaces/:workspace_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/workspaces/:workspace_id',
headers: {'content-type': 'application/json'},
data: {
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/workspaces/:workspace_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"workspace":{"collections":[{"id":"","name":"","uid":""}],"description":"","environments":[{"id":"","name":"","uid":""}],"mocks":[{"id":""}],"monitors":[{"id":""}],"name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/workspaces/:workspace_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "workspace": {\n "collections": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "description": "",\n "environments": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "mocks": [\n {\n "id": ""\n }\n ],\n "monitors": [\n {\n "id": ""\n }\n ],\n "name": ""\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 \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/workspaces/:workspace_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/workspaces/:workspace_id',
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({
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/workspaces/:workspace_id',
headers: {'content-type': 'application/json'},
body: {
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/workspaces/:workspace_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
workspace: {
collections: [
{
id: '',
name: '',
uid: ''
}
],
description: '',
environments: [
{
id: '',
name: '',
uid: ''
}
],
mocks: [
{
id: ''
}
],
monitors: [
{
id: ''
}
],
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: 'PUT',
url: '{{baseUrl}}/workspaces/:workspace_id',
headers: {'content-type': 'application/json'},
data: {
workspace: {
collections: [{id: '', name: '', uid: ''}],
description: '',
environments: [{id: '', name: '', uid: ''}],
mocks: [{id: ''}],
monitors: [{id: ''}],
name: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/workspaces/:workspace_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"workspace":{"collections":[{"id":"","name":"","uid":""}],"description":"","environments":[{"id":"","name":"","uid":""}],"mocks":[{"id":""}],"monitors":[{"id":""}],"name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"workspace": @{ @"collections": @[ @{ @"id": @"", @"name": @"", @"uid": @"" } ], @"description": @"", @"environments": @[ @{ @"id": @"", @"name": @"", @"uid": @"" } ], @"mocks": @[ @{ @"id": @"" } ], @"monitors": @[ @{ @"id": @"" } ], @"name": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/workspaces/:workspace_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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}}/workspaces/:workspace_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/workspaces/:workspace_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'workspace' => [
'collections' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'description' => '',
'environments' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'mocks' => [
[
'id' => ''
]
],
'monitors' => [
[
'id' => ''
]
],
'name' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/workspaces/:workspace_id', [
'body' => '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/workspaces/:workspace_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'workspace' => [
'collections' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'description' => '',
'environments' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'mocks' => [
[
'id' => ''
]
],
'monitors' => [
[
'id' => ''
]
],
'name' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'workspace' => [
'collections' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'description' => '',
'environments' => [
[
'id' => '',
'name' => '',
'uid' => ''
]
],
'mocks' => [
[
'id' => ''
]
],
'monitors' => [
[
'id' => ''
]
],
'name' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/workspaces/:workspace_id');
$request->setRequestMethod('PUT');
$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}}/workspaces/:workspace_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/workspaces/:workspace_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/workspaces/:workspace_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/workspaces/:workspace_id"
payload = { "workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [{ "id": "" }],
"monitors": [{ "id": "" }],
"name": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/workspaces/:workspace_id"
payload <- "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/workspaces/:workspace_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\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.put('/baseUrl/workspaces/:workspace_id') do |req|
req.body = "{\n \"workspace\": {\n \"collections\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"description\": \"\",\n \"environments\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"mocks\": [\n {\n \"id\": \"\"\n }\n ],\n \"monitors\": [\n {\n \"id\": \"\"\n }\n ],\n \"name\": \"\"\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}}/workspaces/:workspace_id";
let payload = json!({"workspace": json!({
"collections": (
json!({
"id": "",
"name": "",
"uid": ""
})
),
"description": "",
"environments": (
json!({
"id": "",
"name": "",
"uid": ""
})
),
"mocks": (json!({"id": ""})),
"monitors": (json!({"id": ""})),
"name": ""
})});
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("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/workspaces/:workspace_id \
--header 'content-type: application/json' \
--data '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": ""
}
}'
echo '{
"workspace": {
"collections": [
{
"id": "",
"name": "",
"uid": ""
}
],
"description": "",
"environments": [
{
"id": "",
"name": "",
"uid": ""
}
],
"mocks": [
{
"id": ""
}
],
"monitors": [
{
"id": ""
}
],
"name": ""
}
}' | \
http PUT {{baseUrl}}/workspaces/:workspace_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "workspace": {\n "collections": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "description": "",\n "environments": [\n {\n "id": "",\n "name": "",\n "uid": ""\n }\n ],\n "mocks": [\n {\n "id": ""\n }\n ],\n "monitors": [\n {\n "id": ""\n }\n ],\n "name": ""\n }\n}' \
--output-document \
- {{baseUrl}}/workspaces/:workspace_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["workspace": [
"collections": [
[
"id": "",
"name": "",
"uid": ""
]
],
"description": "",
"environments": [
[
"id": "",
"name": "",
"uid": ""
]
],
"mocks": [["id": ""]],
"monitors": [["id": ""]],
"name": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/workspaces/:workspace_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"workspace": {
"id": "cfbcd9bf-cc8b-4d6f-b8ef-440a3e49e29f",
"name": "New Workspace"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "You do not have access to update this workspace.",
"name": "forbiddenError"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error": {
"message": "The specified workspace does not exist.",
"name": "instanceNotFoundError"
}
}