WireMock
POST
Find near misses matching request pattern
{{baseUrl}}/__admin/near-misses/request-pattern
BODY json
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/near-misses/request-pattern");
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/near-misses/request-pattern" {:content-type :json
:form-params {:basicAuthCredentials {:password ""
:username ""}
:bodyPatterns [{}]
:cookies {}
:headers {}
:method ""
:queryParameters {}
:url ""
:urlPath ""
:urlPathPattern ""
:urlPattern ""}})
require "http/client"
url = "{{baseUrl}}/__admin/near-misses/request-pattern"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/near-misses/request-pattern"),
Content = new StringContent("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/near-misses/request-pattern");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/near-misses/request-pattern"
payload := strings.NewReader("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/near-misses/request-pattern HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 255
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/near-misses/request-pattern")
.setHeader("content-type", "application/json")
.setBody("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/near-misses/request-pattern"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/near-misses/request-pattern")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/near-misses/request-pattern")
.header("content-type", "application/json")
.body("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.asString();
const data = JSON.stringify({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/near-misses/request-pattern');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/near-misses/request-pattern',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/near-misses/request-pattern';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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}}/__admin/near-misses/request-pattern',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/near-misses/request-pattern")
.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/__admin/near-misses/request-pattern',
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({
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/near-misses/request-pattern',
headers: {'content-type': 'application/json'},
body: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
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}}/__admin/near-misses/request-pattern');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
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}}/__admin/near-misses/request-pattern',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/near-misses/request-pattern';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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 = @{ @"basicAuthCredentials": @{ @"password": @"", @"username": @"" },
@"bodyPatterns": @[ @{ } ],
@"cookies": @{ },
@"headers": @{ },
@"method": @"",
@"queryParameters": @{ },
@"url": @"",
@"urlPath": @"",
@"urlPathPattern": @"",
@"urlPattern": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/near-misses/request-pattern"]
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}}/__admin/near-misses/request-pattern" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/near-misses/request-pattern",
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([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]),
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}}/__admin/near-misses/request-pattern', [
'body' => '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/near-misses/request-pattern');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
$request->setRequestUrl('{{baseUrl}}/__admin/near-misses/request-pattern');
$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}}/__admin/near-misses/request-pattern' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/near-misses/request-pattern' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/near-misses/request-pattern", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/near-misses/request-pattern"
payload = {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [{}],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/near-misses/request-pattern"
payload <- "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/near-misses/request-pattern")
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/near-misses/request-pattern') do |req|
req.body = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/near-misses/request-pattern";
let payload = json!({
"basicAuthCredentials": json!({
"password": "",
"username": ""
}),
"bodyPatterns": (json!({})),
"cookies": json!({}),
"headers": json!({}),
"method": "",
"queryParameters": json!({}),
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
});
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}}/__admin/near-misses/request-pattern \
--header 'content-type: application/json' \
--data '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
echo '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}' | \
http POST {{baseUrl}}/__admin/near-misses/request-pattern \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}' \
--output-document \
- {{baseUrl}}/__admin/near-misses/request-pattern
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"basicAuthCredentials": [
"password": "",
"username": ""
],
"bodyPatterns": [[]],
"cookies": [],
"headers": [],
"method": "",
"queryParameters": [],
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/near-misses/request-pattern")! 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
{
"nearMisses": [
{
"matchResult": {
"distance": 0.06944444444444445
},
"request": {
"absoluteUrl": "http://localhost:8080/nomatch",
"body": "",
"bodyAsBase64": "",
"browserProxyRequest": false,
"clientIp": "0:0:0:0:0:0:0:1",
"cookies": {},
"headers": {
"Accept": "*/*",
"Host": "localhost:8080",
"User-Agent": "curl/7.30.0"
},
"loggedDate": 1467402464520,
"loggedDateString": "2016-07-01T19:47:44Z",
"method": "GET",
"url": "/nomatch"
},
"requestPattern": {
"method": "GET",
"url": "/almostmatch"
}
}
]
}
POST
Find near misses matching specific request
{{baseUrl}}/__admin/near-misses/request
BODY json
{
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/near-misses/request");
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 \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/near-misses/request" {:content-type :json
:form-params {:absoluteUrl ""
:body ""
:cookies {}
:headers {}
:method ""
:url ""}})
require "http/client"
url = "{{baseUrl}}/__admin/near-misses/request"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\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}}/__admin/near-misses/request"),
Content = new StringContent("{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\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}}/__admin/near-misses/request");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/near-misses/request"
payload := strings.NewReader("{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\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/__admin/near-misses/request HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 100
{
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/near-misses/request")
.setHeader("content-type", "application/json")
.setBody("{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/near-misses/request"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\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 \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/near-misses/request")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/near-misses/request")
.header("content-type", "application/json")
.body("{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
absoluteUrl: '',
body: '',
cookies: {},
headers: {},
method: '',
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/near-misses/request');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/near-misses/request',
headers: {'content-type': 'application/json'},
data: {absoluteUrl: '', body: '', cookies: {}, headers: {}, method: '', url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/near-misses/request';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"absoluteUrl":"","body":"","cookies":{},"headers":{},"method":"","url":""}'
};
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}}/__admin/near-misses/request',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "absoluteUrl": "",\n "body": "",\n "cookies": {},\n "headers": {},\n "method": "",\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/near-misses/request")
.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/__admin/near-misses/request',
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({absoluteUrl: '', body: '', cookies: {}, headers: {}, method: '', url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/near-misses/request',
headers: {'content-type': 'application/json'},
body: {absoluteUrl: '', body: '', cookies: {}, headers: {}, method: '', url: ''},
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}}/__admin/near-misses/request');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
absoluteUrl: '',
body: '',
cookies: {},
headers: {},
method: '',
url: ''
});
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}}/__admin/near-misses/request',
headers: {'content-type': 'application/json'},
data: {absoluteUrl: '', body: '', cookies: {}, headers: {}, method: '', url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/near-misses/request';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"absoluteUrl":"","body":"","cookies":{},"headers":{},"method":"","url":""}'
};
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 = @{ @"absoluteUrl": @"",
@"body": @"",
@"cookies": @{ },
@"headers": @{ },
@"method": @"",
@"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/near-misses/request"]
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}}/__admin/near-misses/request" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/near-misses/request",
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([
'absoluteUrl' => '',
'body' => '',
'cookies' => [
],
'headers' => [
],
'method' => '',
'url' => ''
]),
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}}/__admin/near-misses/request', [
'body' => '{
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/near-misses/request');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'absoluteUrl' => '',
'body' => '',
'cookies' => [
],
'headers' => [
],
'method' => '',
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'absoluteUrl' => '',
'body' => '',
'cookies' => [
],
'headers' => [
],
'method' => '',
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/__admin/near-misses/request');
$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}}/__admin/near-misses/request' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/near-misses/request' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/near-misses/request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/near-misses/request"
payload = {
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/near-misses/request"
payload <- "{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\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}}/__admin/near-misses/request")
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 \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\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/__admin/near-misses/request') do |req|
req.body = "{\n \"absoluteUrl\": \"\",\n \"body\": \"\",\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/near-misses/request";
let payload = json!({
"absoluteUrl": "",
"body": "",
"cookies": json!({}),
"headers": json!({}),
"method": "",
"url": ""
});
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}}/__admin/near-misses/request \
--header 'content-type: application/json' \
--data '{
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}'
echo '{
"absoluteUrl": "",
"body": "",
"cookies": {},
"headers": {},
"method": "",
"url": ""
}' | \
http POST {{baseUrl}}/__admin/near-misses/request \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "absoluteUrl": "",\n "body": "",\n "cookies": {},\n "headers": {},\n "method": "",\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/__admin/near-misses/request
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"absoluteUrl": "",
"body": "",
"cookies": [],
"headers": [],
"method": "",
"url": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/near-misses/request")! 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
{
"nearMisses": [
{
"matchResult": {
"distance": 0.06944444444444445
},
"request": {
"absoluteUrl": "http://localhost:8080/nomatch",
"body": "",
"bodyAsBase64": "",
"browserProxyRequest": false,
"clientIp": "0:0:0:0:0:0:0:1",
"cookies": {},
"headers": {
"Accept": "*/*",
"Host": "localhost:8080",
"User-Agent": "curl/7.30.0"
},
"loggedDate": 1467402464520,
"loggedDateString": "2016-07-01T19:47:44Z",
"method": "GET",
"url": "/nomatch"
},
"requestPattern": {
"method": "GET",
"url": "/almostmatch"
}
}
]
}
GET
Retrieve near-misses for all unmatched requests
{{baseUrl}}/__admin/requests/unmatched/near-misses
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/unmatched/near-misses");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/requests/unmatched/near-misses")
require "http/client"
url = "{{baseUrl}}/__admin/requests/unmatched/near-misses"
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}}/__admin/requests/unmatched/near-misses"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests/unmatched/near-misses");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/unmatched/near-misses"
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/__admin/requests/unmatched/near-misses HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/requests/unmatched/near-misses")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/unmatched/near-misses"))
.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}}/__admin/requests/unmatched/near-misses")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/requests/unmatched/near-misses")
.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}}/__admin/requests/unmatched/near-misses');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/__admin/requests/unmatched/near-misses'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/unmatched/near-misses';
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}}/__admin/requests/unmatched/near-misses',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/unmatched/near-misses")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests/unmatched/near-misses',
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}}/__admin/requests/unmatched/near-misses'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/requests/unmatched/near-misses');
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}}/__admin/requests/unmatched/near-misses'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/unmatched/near-misses';
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}}/__admin/requests/unmatched/near-misses"]
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}}/__admin/requests/unmatched/near-misses" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/unmatched/near-misses",
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}}/__admin/requests/unmatched/near-misses');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/unmatched/near-misses');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests/unmatched/near-misses');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests/unmatched/near-misses' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/unmatched/near-misses' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/requests/unmatched/near-misses")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/unmatched/near-misses"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/unmatched/near-misses"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests/unmatched/near-misses")
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/__admin/requests/unmatched/near-misses') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/unmatched/near-misses";
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}}/__admin/requests/unmatched/near-misses
http GET {{baseUrl}}/__admin/requests/unmatched/near-misses
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/requests/unmatched/near-misses
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/unmatched/near-misses")! 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
{
"nearMisses": [
{
"matchResult": {
"distance": 0.06944444444444445
},
"request": {
"absoluteUrl": "http://localhost:8080/nomatch",
"body": "",
"bodyAsBase64": "",
"browserProxyRequest": false,
"clientIp": "0:0:0:0:0:0:0:1",
"cookies": {},
"headers": {
"Accept": "*/*",
"Host": "localhost:8080",
"User-Agent": "curl/7.30.0"
},
"loggedDate": 1467402464520,
"loggedDateString": "2016-07-01T19:47:44Z",
"method": "GET",
"url": "/nomatch"
},
"requestPattern": {
"method": "GET",
"url": "/almostmatch"
}
}
]
}
GET
Get recording status
{{baseUrl}}/__admin/recordings/status
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/recordings/status");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/recordings/status")
require "http/client"
url = "{{baseUrl}}/__admin/recordings/status"
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}}/__admin/recordings/status"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/recordings/status");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/recordings/status"
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/__admin/recordings/status HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/recordings/status")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/recordings/status"))
.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}}/__admin/recordings/status")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/recordings/status")
.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}}/__admin/recordings/status');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/__admin/recordings/status'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/recordings/status';
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}}/__admin/recordings/status',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/recordings/status")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/recordings/status',
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}}/__admin/recordings/status'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/recordings/status');
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}}/__admin/recordings/status'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/recordings/status';
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}}/__admin/recordings/status"]
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}}/__admin/recordings/status" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/recordings/status",
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}}/__admin/recordings/status');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/recordings/status');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/recordings/status');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/recordings/status' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/recordings/status' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/recordings/status")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/recordings/status"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/recordings/status"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/recordings/status")
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/__admin/recordings/status') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/recordings/status";
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}}/__admin/recordings/status
http GET {{baseUrl}}/__admin/recordings/status
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/recordings/status
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/recordings/status")! 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
{
"status": "Stopped"
}
POST
Start recording
{{baseUrl}}/__admin/recordings/start
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/recordings/start");
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 \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/recordings/start" {:content-type :json
:form-params {:captureHeaders {:Accept {}
:Content-Type {:caseInsensitive true}}
:extractBodyCriteria {:binarySizeThreshold "10240"
:textSizeThreshold "2048"}
:filters {:method "GET"
:urlPathPattern "/api/.*"}
:persist false
:repeatsAsScenarios false
:requestBodyPattern {:ignoreArrayOrder false
:ignoreExtraElements true
:matcher "equalToJson"}
:targetBaseUrl "http://example.mocklab.io"
:transformerParameters {:headerValue "123"}
:transformers ["modify-response-header"]}})
require "http/client"
url = "{{baseUrl}}/__admin/recordings/start"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\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}}/__admin/recordings/start"),
Content = new StringContent("{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\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}}/__admin/recordings/start");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/recordings/start"
payload := strings.NewReader("{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\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/__admin/recordings/start HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 614
{
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"extractBodyCriteria": {
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
},
"filters": {
"method": "GET",
"urlPathPattern": "/api/.*"
},
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": {
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
},
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": {
"headerValue": "123"
},
"transformers": [
"modify-response-header"
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/recordings/start")
.setHeader("content-type", "application/json")
.setBody("{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/recordings/start"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\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 \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/recordings/start")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/recordings/start")
.header("content-type", "application/json")
.body("{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}")
.asString();
const data = JSON.stringify({
captureHeaders: {
Accept: {},
'Content-Type': {
caseInsensitive: true
}
},
extractBodyCriteria: {
binarySizeThreshold: '10240',
textSizeThreshold: '2048'
},
filters: {
method: 'GET',
urlPathPattern: '/api/.*'
},
persist: false,
repeatsAsScenarios: false,
requestBodyPattern: {
ignoreArrayOrder: false,
ignoreExtraElements: true,
matcher: 'equalToJson'
},
targetBaseUrl: 'http://example.mocklab.io',
transformerParameters: {
headerValue: '123'
},
transformers: [
'modify-response-header'
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/recordings/start');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/recordings/start',
headers: {'content-type': 'application/json'},
data: {
captureHeaders: {Accept: {}, 'Content-Type': {caseInsensitive: true}},
extractBodyCriteria: {binarySizeThreshold: '10240', textSizeThreshold: '2048'},
filters: {method: 'GET', urlPathPattern: '/api/.*'},
persist: false,
repeatsAsScenarios: false,
requestBodyPattern: {ignoreArrayOrder: false, ignoreExtraElements: true, matcher: 'equalToJson'},
targetBaseUrl: 'http://example.mocklab.io',
transformerParameters: {headerValue: '123'},
transformers: ['modify-response-header']
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/recordings/start';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"captureHeaders":{"Accept":{},"Content-Type":{"caseInsensitive":true}},"extractBodyCriteria":{"binarySizeThreshold":"10240","textSizeThreshold":"2048"},"filters":{"method":"GET","urlPathPattern":"/api/.*"},"persist":false,"repeatsAsScenarios":false,"requestBodyPattern":{"ignoreArrayOrder":false,"ignoreExtraElements":true,"matcher":"equalToJson"},"targetBaseUrl":"http://example.mocklab.io","transformerParameters":{"headerValue":"123"},"transformers":["modify-response-header"]}'
};
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}}/__admin/recordings/start',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "captureHeaders": {\n "Accept": {},\n "Content-Type": {\n "caseInsensitive": true\n }\n },\n "extractBodyCriteria": {\n "binarySizeThreshold": "10240",\n "textSizeThreshold": "2048"\n },\n "filters": {\n "method": "GET",\n "urlPathPattern": "/api/.*"\n },\n "persist": false,\n "repeatsAsScenarios": false,\n "requestBodyPattern": {\n "ignoreArrayOrder": false,\n "ignoreExtraElements": true,\n "matcher": "equalToJson"\n },\n "targetBaseUrl": "http://example.mocklab.io",\n "transformerParameters": {\n "headerValue": "123"\n },\n "transformers": [\n "modify-response-header"\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 \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/recordings/start")
.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/__admin/recordings/start',
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({
captureHeaders: {Accept: {}, 'Content-Type': {caseInsensitive: true}},
extractBodyCriteria: {binarySizeThreshold: '10240', textSizeThreshold: '2048'},
filters: {method: 'GET', urlPathPattern: '/api/.*'},
persist: false,
repeatsAsScenarios: false,
requestBodyPattern: {ignoreArrayOrder: false, ignoreExtraElements: true, matcher: 'equalToJson'},
targetBaseUrl: 'http://example.mocklab.io',
transformerParameters: {headerValue: '123'},
transformers: ['modify-response-header']
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/recordings/start',
headers: {'content-type': 'application/json'},
body: {
captureHeaders: {Accept: {}, 'Content-Type': {caseInsensitive: true}},
extractBodyCriteria: {binarySizeThreshold: '10240', textSizeThreshold: '2048'},
filters: {method: 'GET', urlPathPattern: '/api/.*'},
persist: false,
repeatsAsScenarios: false,
requestBodyPattern: {ignoreArrayOrder: false, ignoreExtraElements: true, matcher: 'equalToJson'},
targetBaseUrl: 'http://example.mocklab.io',
transformerParameters: {headerValue: '123'},
transformers: ['modify-response-header']
},
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}}/__admin/recordings/start');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
captureHeaders: {
Accept: {},
'Content-Type': {
caseInsensitive: true
}
},
extractBodyCriteria: {
binarySizeThreshold: '10240',
textSizeThreshold: '2048'
},
filters: {
method: 'GET',
urlPathPattern: '/api/.*'
},
persist: false,
repeatsAsScenarios: false,
requestBodyPattern: {
ignoreArrayOrder: false,
ignoreExtraElements: true,
matcher: 'equalToJson'
},
targetBaseUrl: 'http://example.mocklab.io',
transformerParameters: {
headerValue: '123'
},
transformers: [
'modify-response-header'
]
});
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}}/__admin/recordings/start',
headers: {'content-type': 'application/json'},
data: {
captureHeaders: {Accept: {}, 'Content-Type': {caseInsensitive: true}},
extractBodyCriteria: {binarySizeThreshold: '10240', textSizeThreshold: '2048'},
filters: {method: 'GET', urlPathPattern: '/api/.*'},
persist: false,
repeatsAsScenarios: false,
requestBodyPattern: {ignoreArrayOrder: false, ignoreExtraElements: true, matcher: 'equalToJson'},
targetBaseUrl: 'http://example.mocklab.io',
transformerParameters: {headerValue: '123'},
transformers: ['modify-response-header']
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/recordings/start';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"captureHeaders":{"Accept":{},"Content-Type":{"caseInsensitive":true}},"extractBodyCriteria":{"binarySizeThreshold":"10240","textSizeThreshold":"2048"},"filters":{"method":"GET","urlPathPattern":"/api/.*"},"persist":false,"repeatsAsScenarios":false,"requestBodyPattern":{"ignoreArrayOrder":false,"ignoreExtraElements":true,"matcher":"equalToJson"},"targetBaseUrl":"http://example.mocklab.io","transformerParameters":{"headerValue":"123"},"transformers":["modify-response-header"]}'
};
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 = @{ @"captureHeaders": @{ @"Accept": @{ }, @"Content-Type": @{ @"caseInsensitive": @YES } },
@"extractBodyCriteria": @{ @"binarySizeThreshold": @"10240", @"textSizeThreshold": @"2048" },
@"filters": @{ @"method": @"GET", @"urlPathPattern": @"/api/.*" },
@"persist": @NO,
@"repeatsAsScenarios": @NO,
@"requestBodyPattern": @{ @"ignoreArrayOrder": @NO, @"ignoreExtraElements": @YES, @"matcher": @"equalToJson" },
@"targetBaseUrl": @"http://example.mocklab.io",
@"transformerParameters": @{ @"headerValue": @"123" },
@"transformers": @[ @"modify-response-header" ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/recordings/start"]
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}}/__admin/recordings/start" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/recordings/start",
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([
'captureHeaders' => [
'Accept' => [
],
'Content-Type' => [
'caseInsensitive' => null
]
],
'extractBodyCriteria' => [
'binarySizeThreshold' => '10240',
'textSizeThreshold' => '2048'
],
'filters' => [
'method' => 'GET',
'urlPathPattern' => '/api/.*'
],
'persist' => null,
'repeatsAsScenarios' => null,
'requestBodyPattern' => [
'ignoreArrayOrder' => null,
'ignoreExtraElements' => null,
'matcher' => 'equalToJson'
],
'targetBaseUrl' => 'http://example.mocklab.io',
'transformerParameters' => [
'headerValue' => '123'
],
'transformers' => [
'modify-response-header'
]
]),
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}}/__admin/recordings/start', [
'body' => '{
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"extractBodyCriteria": {
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
},
"filters": {
"method": "GET",
"urlPathPattern": "/api/.*"
},
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": {
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
},
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": {
"headerValue": "123"
},
"transformers": [
"modify-response-header"
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/recordings/start');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'captureHeaders' => [
'Accept' => [
],
'Content-Type' => [
'caseInsensitive' => null
]
],
'extractBodyCriteria' => [
'binarySizeThreshold' => '10240',
'textSizeThreshold' => '2048'
],
'filters' => [
'method' => 'GET',
'urlPathPattern' => '/api/.*'
],
'persist' => null,
'repeatsAsScenarios' => null,
'requestBodyPattern' => [
'ignoreArrayOrder' => null,
'ignoreExtraElements' => null,
'matcher' => 'equalToJson'
],
'targetBaseUrl' => 'http://example.mocklab.io',
'transformerParameters' => [
'headerValue' => '123'
],
'transformers' => [
'modify-response-header'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'captureHeaders' => [
'Accept' => [
],
'Content-Type' => [
'caseInsensitive' => null
]
],
'extractBodyCriteria' => [
'binarySizeThreshold' => '10240',
'textSizeThreshold' => '2048'
],
'filters' => [
'method' => 'GET',
'urlPathPattern' => '/api/.*'
],
'persist' => null,
'repeatsAsScenarios' => null,
'requestBodyPattern' => [
'ignoreArrayOrder' => null,
'ignoreExtraElements' => null,
'matcher' => 'equalToJson'
],
'targetBaseUrl' => 'http://example.mocklab.io',
'transformerParameters' => [
'headerValue' => '123'
],
'transformers' => [
'modify-response-header'
]
]));
$request->setRequestUrl('{{baseUrl}}/__admin/recordings/start');
$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}}/__admin/recordings/start' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"extractBodyCriteria": {
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
},
"filters": {
"method": "GET",
"urlPathPattern": "/api/.*"
},
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": {
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
},
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": {
"headerValue": "123"
},
"transformers": [
"modify-response-header"
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/recordings/start' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"extractBodyCriteria": {
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
},
"filters": {
"method": "GET",
"urlPathPattern": "/api/.*"
},
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": {
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
},
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": {
"headerValue": "123"
},
"transformers": [
"modify-response-header"
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/recordings/start", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/recordings/start"
payload = {
"captureHeaders": {
"Accept": {},
"Content-Type": { "caseInsensitive": True }
},
"extractBodyCriteria": {
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
},
"filters": {
"method": "GET",
"urlPathPattern": "/api/.*"
},
"persist": False,
"repeatsAsScenarios": False,
"requestBodyPattern": {
"ignoreArrayOrder": False,
"ignoreExtraElements": True,
"matcher": "equalToJson"
},
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": { "headerValue": "123" },
"transformers": ["modify-response-header"]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/recordings/start"
payload <- "{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\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}}/__admin/recordings/start")
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 \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\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/__admin/recordings/start') do |req|
req.body = "{\n \"captureHeaders\": {\n \"Accept\": {},\n \"Content-Type\": {\n \"caseInsensitive\": true\n }\n },\n \"extractBodyCriteria\": {\n \"binarySizeThreshold\": \"10240\",\n \"textSizeThreshold\": \"2048\"\n },\n \"filters\": {\n \"method\": \"GET\",\n \"urlPathPattern\": \"/api/.*\"\n },\n \"persist\": false,\n \"repeatsAsScenarios\": false,\n \"requestBodyPattern\": {\n \"ignoreArrayOrder\": false,\n \"ignoreExtraElements\": true,\n \"matcher\": \"equalToJson\"\n },\n \"targetBaseUrl\": \"http://example.mocklab.io\",\n \"transformerParameters\": {\n \"headerValue\": \"123\"\n },\n \"transformers\": [\n \"modify-response-header\"\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/recordings/start";
let payload = json!({
"captureHeaders": json!({
"Accept": json!({}),
"Content-Type": json!({"caseInsensitive": true})
}),
"extractBodyCriteria": json!({
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
}),
"filters": json!({
"method": "GET",
"urlPathPattern": "/api/.*"
}),
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": json!({
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
}),
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": json!({"headerValue": "123"}),
"transformers": ("modify-response-header")
});
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}}/__admin/recordings/start \
--header 'content-type: application/json' \
--data '{
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"extractBodyCriteria": {
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
},
"filters": {
"method": "GET",
"urlPathPattern": "/api/.*"
},
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": {
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
},
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": {
"headerValue": "123"
},
"transformers": [
"modify-response-header"
]
}'
echo '{
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"extractBodyCriteria": {
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
},
"filters": {
"method": "GET",
"urlPathPattern": "/api/.*"
},
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": {
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
},
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": {
"headerValue": "123"
},
"transformers": [
"modify-response-header"
]
}' | \
http POST {{baseUrl}}/__admin/recordings/start \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "captureHeaders": {\n "Accept": {},\n "Content-Type": {\n "caseInsensitive": true\n }\n },\n "extractBodyCriteria": {\n "binarySizeThreshold": "10240",\n "textSizeThreshold": "2048"\n },\n "filters": {\n "method": "GET",\n "urlPathPattern": "/api/.*"\n },\n "persist": false,\n "repeatsAsScenarios": false,\n "requestBodyPattern": {\n "ignoreArrayOrder": false,\n "ignoreExtraElements": true,\n "matcher": "equalToJson"\n },\n "targetBaseUrl": "http://example.mocklab.io",\n "transformerParameters": {\n "headerValue": "123"\n },\n "transformers": [\n "modify-response-header"\n ]\n}' \
--output-document \
- {{baseUrl}}/__admin/recordings/start
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"captureHeaders": [
"Accept": [],
"Content-Type": ["caseInsensitive": true]
],
"extractBodyCriteria": [
"binarySizeThreshold": "10240",
"textSizeThreshold": "2048"
],
"filters": [
"method": "GET",
"urlPathPattern": "/api/.*"
],
"persist": false,
"repeatsAsScenarios": false,
"requestBodyPattern": [
"ignoreArrayOrder": false,
"ignoreExtraElements": true,
"matcher": "equalToJson"
],
"targetBaseUrl": "http://example.mocklab.io",
"transformerParameters": ["headerValue": "123"],
"transformers": ["modify-response-header"]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/recordings/start")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Stop recording
{{baseUrl}}/__admin/recordings/stop
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/recordings/stop");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/recordings/stop")
require "http/client"
url = "{{baseUrl}}/__admin/recordings/stop"
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}}/__admin/recordings/stop"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/recordings/stop");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/recordings/stop"
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/__admin/recordings/stop HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/recordings/stop")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/recordings/stop"))
.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}}/__admin/recordings/stop")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/recordings/stop")
.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}}/__admin/recordings/stop');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/recordings/stop'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/recordings/stop';
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}}/__admin/recordings/stop',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/recordings/stop")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/recordings/stop',
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}}/__admin/recordings/stop'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/recordings/stop');
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}}/__admin/recordings/stop'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/recordings/stop';
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}}/__admin/recordings/stop"]
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}}/__admin/recordings/stop" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/recordings/stop",
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}}/__admin/recordings/stop');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/recordings/stop');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/recordings/stop');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/recordings/stop' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/recordings/stop' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/recordings/stop")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/recordings/stop"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/recordings/stop"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/recordings/stop")
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/__admin/recordings/stop') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/recordings/stop";
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}}/__admin/recordings/stop
http POST {{baseUrl}}/__admin/recordings/stop
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/recordings/stop
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/recordings/stop")! 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
{
"mappings": [
{
"id": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7",
"name": "recordables_123",
"persistent": true,
"request": {
"method": "GET",
"url": "/recordables/123"
},
"response": {
"body": "{\n \"message\": \"Congratulations on your first recording!\"\n}",
"headers": {
"Content-Type": "application/json"
},
"status": 200
},
"uuid": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7"
}
]
}
POST
Take a snapshot recording
{{baseUrl}}/__admin/recordings/snapshot
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/recordings/snapshot");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/recordings/snapshot" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/__admin/recordings/snapshot"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/__admin/recordings/snapshot"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/recordings/snapshot");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/recordings/snapshot"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/__admin/recordings/snapshot HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/recordings/snapshot")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/recordings/snapshot"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/recordings/snapshot")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/recordings/snapshot")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/recordings/snapshot');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/recordings/snapshot',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/recordings/snapshot';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/__admin/recordings/snapshot',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/recordings/snapshot")
.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/__admin/recordings/snapshot',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/recordings/snapshot',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/recordings/snapshot');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/recordings/snapshot',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/recordings/snapshot';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/recordings/snapshot"]
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}}/__admin/recordings/snapshot" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/recordings/snapshot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/__admin/recordings/snapshot', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/recordings/snapshot');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/__admin/recordings/snapshot');
$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}}/__admin/recordings/snapshot' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/recordings/snapshot' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/recordings/snapshot", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/recordings/snapshot"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/recordings/snapshot"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/recordings/snapshot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/__admin/recordings/snapshot') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/recordings/snapshot";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/__admin/recordings/snapshot \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/__admin/recordings/snapshot \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/__admin/recordings/snapshot
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/recordings/snapshot")! 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
{
"mappings": [
{
"id": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7",
"name": "recordables_123",
"persistent": true,
"request": {
"method": "GET",
"url": "/recordables/123"
},
"response": {
"body": "{\n \"message\": \"Congratulations on your first recording!\"\n}",
"headers": {
"Content-Type": "application/json"
},
"status": 200
},
"uuid": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7"
}
]
}
POST
Count requests by criteria
{{baseUrl}}/__admin/requests/count
BODY json
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/count");
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/requests/count" {:content-type :json
:form-params {:basicAuthCredentials {:password ""
:username ""}
:bodyPatterns [{}]
:cookies {}
:headers {}
:method ""
:queryParameters {}
:url ""
:urlPath ""
:urlPathPattern ""
:urlPattern ""}})
require "http/client"
url = "{{baseUrl}}/__admin/requests/count"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/count"),
Content = new StringContent("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/count");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/count"
payload := strings.NewReader("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/requests/count HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 255
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/requests/count")
.setHeader("content-type", "application/json")
.setBody("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/count"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/requests/count")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/requests/count")
.header("content-type", "application/json")
.body("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.asString();
const data = JSON.stringify({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/requests/count');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/requests/count',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/count';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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}}/__admin/requests/count',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/count")
.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/__admin/requests/count',
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({
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/requests/count',
headers: {'content-type': 'application/json'},
body: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
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}}/__admin/requests/count');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
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}}/__admin/requests/count',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/count';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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 = @{ @"basicAuthCredentials": @{ @"password": @"", @"username": @"" },
@"bodyPatterns": @[ @{ } ],
@"cookies": @{ },
@"headers": @{ },
@"method": @"",
@"queryParameters": @{ },
@"url": @"",
@"urlPath": @"",
@"urlPathPattern": @"",
@"urlPattern": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/requests/count"]
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}}/__admin/requests/count" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/count",
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([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]),
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}}/__admin/requests/count', [
'body' => '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/count');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
$request->setRequestUrl('{{baseUrl}}/__admin/requests/count');
$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}}/__admin/requests/count' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/count' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/requests/count", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/count"
payload = {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [{}],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/count"
payload <- "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/count")
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/requests/count') do |req|
req.body = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/count";
let payload = json!({
"basicAuthCredentials": json!({
"password": "",
"username": ""
}),
"bodyPatterns": (json!({})),
"cookies": json!({}),
"headers": json!({}),
"method": "",
"queryParameters": json!({}),
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
});
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}}/__admin/requests/count \
--header 'content-type: application/json' \
--data '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
echo '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}' | \
http POST {{baseUrl}}/__admin/requests/count \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}' \
--output-document \
- {{baseUrl}}/__admin/requests/count
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"basicAuthCredentials": [
"password": "",
"username": ""
],
"bodyPatterns": [[]],
"cookies": [],
"headers": [],
"method": "",
"queryParameters": [],
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/count")! 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
{
"count": 4
}
DELETE
Delete all requests in journal
{{baseUrl}}/__admin/requests
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/__admin/requests")
require "http/client"
url = "{{baseUrl}}/__admin/requests"
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}}/__admin/requests"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests"
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/__admin/requests HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/__admin/requests")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests"))
.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}}/__admin/requests")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/__admin/requests")
.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}}/__admin/requests');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/__admin/requests'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests';
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}}/__admin/requests',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests',
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}}/__admin/requests'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/__admin/requests');
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}}/__admin/requests'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests';
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}}/__admin/requests"]
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}}/__admin/requests" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests",
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}}/__admin/requests');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/__admin/requests")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests")
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/__admin/requests') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests";
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}}/__admin/requests
http DELETE {{baseUrl}}/__admin/requests
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/__admin/requests
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests")! 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()
DELETE
Delete request by ID
{{baseUrl}}/__admin/requests/:requestId
QUERY PARAMS
requestId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/:requestId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/__admin/requests/:requestId")
require "http/client"
url = "{{baseUrl}}/__admin/requests/:requestId"
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}}/__admin/requests/:requestId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests/:requestId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/:requestId"
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/__admin/requests/:requestId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/__admin/requests/:requestId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/:requestId"))
.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}}/__admin/requests/:requestId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/__admin/requests/:requestId")
.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}}/__admin/requests/:requestId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/__admin/requests/:requestId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/:requestId';
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}}/__admin/requests/:requestId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/:requestId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests/:requestId',
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}}/__admin/requests/:requestId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/__admin/requests/:requestId');
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}}/__admin/requests/:requestId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/:requestId';
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}}/__admin/requests/:requestId"]
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}}/__admin/requests/:requestId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/:requestId",
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}}/__admin/requests/:requestId');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/:requestId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests/:requestId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests/:requestId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/:requestId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/__admin/requests/:requestId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/:requestId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/:requestId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests/:requestId")
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/__admin/requests/:requestId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/:requestId";
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}}/__admin/requests/:requestId
http DELETE {{baseUrl}}/__admin/requests/:requestId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/__admin/requests/:requestId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/:requestId")! 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()
POST
Delete requests mappings matching metadata
{{baseUrl}}/__admin/requests/remove-by-metadata
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/remove-by-metadata");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/requests/remove-by-metadata")
require "http/client"
url = "{{baseUrl}}/__admin/requests/remove-by-metadata"
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}}/__admin/requests/remove-by-metadata"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests/remove-by-metadata");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/remove-by-metadata"
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/__admin/requests/remove-by-metadata HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/requests/remove-by-metadata")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/remove-by-metadata"))
.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}}/__admin/requests/remove-by-metadata")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/requests/remove-by-metadata")
.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}}/__admin/requests/remove-by-metadata');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/requests/remove-by-metadata'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/remove-by-metadata';
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}}/__admin/requests/remove-by-metadata',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/remove-by-metadata")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests/remove-by-metadata',
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}}/__admin/requests/remove-by-metadata'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/requests/remove-by-metadata');
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}}/__admin/requests/remove-by-metadata'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/remove-by-metadata';
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}}/__admin/requests/remove-by-metadata"]
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}}/__admin/requests/remove-by-metadata" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/remove-by-metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/__admin/requests/remove-by-metadata');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/remove-by-metadata');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests/remove-by-metadata');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests/remove-by-metadata' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/remove-by-metadata' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
conn.request("POST", "/baseUrl/__admin/requests/remove-by-metadata", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/remove-by-metadata"
payload = ""
response = requests.post(url, data=payload)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/remove-by-metadata"
payload <- ""
response <- VERB("POST", url, body = payload, content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests/remove-by-metadata")
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/__admin/requests/remove-by-metadata') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/remove-by-metadata";
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}}/__admin/requests/remove-by-metadata
http POST {{baseUrl}}/__admin/requests/remove-by-metadata
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/requests/remove-by-metadata
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/remove-by-metadata")! 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
{
"requests": [
{
"absoluteUrl": "http://mydomain.com/my/url",
"body": "",
"browserProxyRequest": true,
"headers": {
"Accept": "image/png,image/*;q=0.8,*/*;q=0.5",
"Accept-Language": "en-us,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "GET",
"url": "/my/url"
},
{
"absoluteUrl": "http://my.other.domain.com/my/other/url",
"body": "My text",
"browserProxyRequest": false,
"headers": {
"Accept": "text/plain",
"Content-Type": "text/plain"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "POST",
"url": "/my/other/url"
}
]
}
POST
Empty the request journal
{{baseUrl}}/__admin/requests/reset
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/reset");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/requests/reset")
require "http/client"
url = "{{baseUrl}}/__admin/requests/reset"
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}}/__admin/requests/reset"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests/reset");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/reset"
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/__admin/requests/reset HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/requests/reset")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/reset"))
.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}}/__admin/requests/reset")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/requests/reset")
.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}}/__admin/requests/reset');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/requests/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/reset';
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}}/__admin/requests/reset',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/reset")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests/reset',
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}}/__admin/requests/reset'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/requests/reset');
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}}/__admin/requests/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/reset';
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}}/__admin/requests/reset"]
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}}/__admin/requests/reset" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/reset",
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}}/__admin/requests/reset');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/reset');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests/reset');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests/reset' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/reset' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/requests/reset")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/reset"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/reset"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests/reset")
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/__admin/requests/reset') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/reset";
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}}/__admin/requests/reset
http POST {{baseUrl}}/__admin/requests/reset
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/requests/reset
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/reset")! 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()
POST
Find requests by criteria
{{baseUrl}}/__admin/requests/find
BODY json
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/find");
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/requests/find" {:content-type :json
:form-params {:basicAuthCredentials {:password ""
:username ""}
:bodyPatterns [{}]
:cookies {}
:headers {}
:method ""
:queryParameters {}
:url ""
:urlPath ""
:urlPathPattern ""
:urlPattern ""}})
require "http/client"
url = "{{baseUrl}}/__admin/requests/find"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/find"),
Content = new StringContent("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/find");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/find"
payload := strings.NewReader("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/requests/find HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 255
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/requests/find")
.setHeader("content-type", "application/json")
.setBody("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/find"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/requests/find")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/requests/find")
.header("content-type", "application/json")
.body("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.asString();
const data = JSON.stringify({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/requests/find');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/requests/find',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/find';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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}}/__admin/requests/find',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/find")
.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/__admin/requests/find',
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({
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/requests/find',
headers: {'content-type': 'application/json'},
body: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
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}}/__admin/requests/find');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
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}}/__admin/requests/find',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/find';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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 = @{ @"basicAuthCredentials": @{ @"password": @"", @"username": @"" },
@"bodyPatterns": @[ @{ } ],
@"cookies": @{ },
@"headers": @{ },
@"method": @"",
@"queryParameters": @{ },
@"url": @"",
@"urlPath": @"",
@"urlPathPattern": @"",
@"urlPattern": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/requests/find"]
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}}/__admin/requests/find" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/find",
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([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]),
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}}/__admin/requests/find', [
'body' => '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/find');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
$request->setRequestUrl('{{baseUrl}}/__admin/requests/find');
$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}}/__admin/requests/find' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/find' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/requests/find", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/find"
payload = {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [{}],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/find"
payload <- "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/find")
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/requests/find') do |req|
req.body = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/find";
let payload = json!({
"basicAuthCredentials": json!({
"password": "",
"username": ""
}),
"bodyPatterns": (json!({})),
"cookies": json!({}),
"headers": json!({}),
"method": "",
"queryParameters": json!({}),
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
});
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}}/__admin/requests/find \
--header 'content-type: application/json' \
--data '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
echo '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}' | \
http POST {{baseUrl}}/__admin/requests/find \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}' \
--output-document \
- {{baseUrl}}/__admin/requests/find
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"basicAuthCredentials": [
"password": "",
"username": ""
],
"bodyPatterns": [[]],
"cookies": [],
"headers": [],
"method": "",
"queryParameters": [],
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/find")! 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
{
"requests": [
{
"absoluteUrl": "http://mydomain.com/my/url",
"body": "",
"browserProxyRequest": true,
"headers": {
"Accept": "image/png,image/*;q=0.8,*/*;q=0.5",
"Accept-Language": "en-us,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "GET",
"url": "/my/url"
},
{
"absoluteUrl": "http://my.other.domain.com/my/other/url",
"body": "My text",
"browserProxyRequest": false,
"headers": {
"Accept": "text/plain",
"Content-Type": "text/plain"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "POST",
"url": "/my/other/url"
}
]
}
GET
Find unmatched requests
{{baseUrl}}/__admin/requests/unmatched
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/unmatched");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/requests/unmatched")
require "http/client"
url = "{{baseUrl}}/__admin/requests/unmatched"
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}}/__admin/requests/unmatched"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests/unmatched");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/unmatched"
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/__admin/requests/unmatched HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/requests/unmatched")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/unmatched"))
.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}}/__admin/requests/unmatched")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/requests/unmatched")
.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}}/__admin/requests/unmatched');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/__admin/requests/unmatched'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/unmatched';
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}}/__admin/requests/unmatched',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/unmatched")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests/unmatched',
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}}/__admin/requests/unmatched'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/requests/unmatched');
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}}/__admin/requests/unmatched'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/unmatched';
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}}/__admin/requests/unmatched"]
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}}/__admin/requests/unmatched" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/unmatched",
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}}/__admin/requests/unmatched');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/unmatched');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests/unmatched');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests/unmatched' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/unmatched' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/requests/unmatched")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/unmatched"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/unmatched"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests/unmatched")
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/__admin/requests/unmatched') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/unmatched";
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}}/__admin/requests/unmatched
http GET {{baseUrl}}/__admin/requests/unmatched
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/requests/unmatched
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/unmatched")! 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
{
"requests": [
{
"absoluteUrl": "http://mydomain.com/my/url",
"body": "",
"browserProxyRequest": true,
"headers": {
"Accept": "image/png,image/*;q=0.8,*/*;q=0.5",
"Accept-Language": "en-us,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "GET",
"url": "/my/url"
},
{
"absoluteUrl": "http://my.other.domain.com/my/other/url",
"body": "My text",
"browserProxyRequest": false,
"headers": {
"Accept": "text/plain",
"Content-Type": "text/plain"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "POST",
"url": "/my/other/url"
}
]
}
GET
Get all requests in journal
{{baseUrl}}/__admin/requests
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/requests")
require "http/client"
url = "{{baseUrl}}/__admin/requests"
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}}/__admin/requests"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests"
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/__admin/requests HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/requests")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests"))
.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}}/__admin/requests")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/requests")
.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}}/__admin/requests');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/__admin/requests'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests';
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}}/__admin/requests',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests',
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}}/__admin/requests'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/requests');
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}}/__admin/requests'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests';
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}}/__admin/requests"]
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}}/__admin/requests" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests",
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}}/__admin/requests');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/requests")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests")
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/__admin/requests') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests";
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}}/__admin/requests
http GET {{baseUrl}}/__admin/requests
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/requests
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests")! 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
{
"meta": {
"total": 9
},
"requestJournalDisabled": false,
"requests": [
{
"id": "45760a03-eebb-4387-ad0d-bb89b5d3d662",
"request": {
"absoluteUrl": "http://localhost:56715/received-request/9",
"body": "",
"bodyAsBase64": "",
"browserProxyRequest": false,
"clientIp": "127.0.0.1",
"cookies": {},
"headers": {
"Connection": "keep-alive",
"Host": "localhost:56715",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
},
"loggedDate": 1471442494809,
"loggedDateString": "2016-08-17T14:01:34Z",
"method": "GET",
"url": "/received-request/9"
},
"responseDefinition": {
"fromConfiguredStub": false,
"status": 404,
"transformerParameters": {},
"transformers": []
}
},
{
"id": "6ae78311-0178-46c9-987a-fbfc528d54d8",
"request": {
"absoluteUrl": "http://localhost:56715/received-request/8",
"body": "",
"bodyAsBase64": "",
"browserProxyRequest": false,
"clientIp": "127.0.0.1",
"cookies": {},
"headers": {
"Connection": "keep-alive",
"Host": "localhost:56715",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
},
"loggedDate": 1471442494802,
"loggedDateString": "2016-08-17T14:01:34Z",
"method": "GET",
"url": "/received-request/8"
},
"responseDefinition": {
"fromConfiguredStub": false,
"status": 404,
"transformerParameters": {},
"transformers": []
}
},
{
"id": "aba8e4ad-1b5b-4518-8f05-b2170a24de35",
"request": {
"absoluteUrl": "http://localhost:56715/received-request/7",
"body": "",
"bodyAsBase64": "",
"browserProxyRequest": false,
"clientIp": "127.0.0.1",
"cookies": {},
"headers": {
"Connection": "keep-alive",
"Host": "localhost:56715",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
},
"loggedDate": 1471442494795,
"loggedDateString": "2016-08-17T14:01:34Z",
"method": "GET",
"url": "/received-request/7"
},
"responseDefinition": {
"fromConfiguredStub": false,
"status": 404,
"transformerParameters": {},
"transformers": []
}
}
]
}
GET
Get request by ID
{{baseUrl}}/__admin/requests/:requestId
QUERY PARAMS
requestId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/:requestId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/requests/:requestId")
require "http/client"
url = "{{baseUrl}}/__admin/requests/:requestId"
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}}/__admin/requests/:requestId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/requests/:requestId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/:requestId"
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/__admin/requests/:requestId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/requests/:requestId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/:requestId"))
.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}}/__admin/requests/:requestId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/requests/:requestId")
.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}}/__admin/requests/:requestId');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/__admin/requests/:requestId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/:requestId';
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}}/__admin/requests/:requestId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/:requestId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/requests/:requestId',
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}}/__admin/requests/:requestId'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/requests/:requestId');
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}}/__admin/requests/:requestId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/:requestId';
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}}/__admin/requests/:requestId"]
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}}/__admin/requests/:requestId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/:requestId",
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}}/__admin/requests/:requestId');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/:requestId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/requests/:requestId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/requests/:requestId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/:requestId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/requests/:requestId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/:requestId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/:requestId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/requests/:requestId")
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/__admin/requests/:requestId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/:requestId";
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}}/__admin/requests/:requestId
http GET {{baseUrl}}/__admin/requests/:requestId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/requests/:requestId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/:requestId")! 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
{
"id": "12fb14bb-600e-4bfa-bd8d-be7f12562c99",
"request": {
"absoluteUrl": "http://localhost:56738/received-request/2",
"body": "",
"bodyAsBase64": "",
"browserProxyRequest": false,
"clientIp": "127.0.0.1",
"cookies": {},
"headers": {
"Connection": "keep-alive",
"Host": "localhost:56738",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
},
"loggedDate": 1471442557047,
"loggedDateString": "2016-08-17T14:02:37Z",
"method": "GET",
"url": "/received-request/2"
},
"responseDefinition": {
"fromConfiguredStub": false,
"status": 404,
"transformerParameters": {},
"transformers": []
}
}
POST
Remove requests by criteria
{{baseUrl}}/__admin/requests/remove
BODY json
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/requests/remove");
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/requests/remove" {:content-type :json
:form-params {:basicAuthCredentials {:password ""
:username ""}
:bodyPatterns [{}]
:cookies {}
:headers {}
:method ""
:queryParameters {}
:url ""
:urlPath ""
:urlPathPattern ""
:urlPattern ""}})
require "http/client"
url = "{{baseUrl}}/__admin/requests/remove"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/remove"),
Content = new StringContent("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/remove");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/requests/remove"
payload := strings.NewReader("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/requests/remove HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 255
{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/requests/remove")
.setHeader("content-type", "application/json")
.setBody("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/requests/remove"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/requests/remove")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/requests/remove")
.header("content-type", "application/json")
.body("{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
.asString();
const data = JSON.stringify({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/requests/remove');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/requests/remove',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/requests/remove';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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}}/__admin/requests/remove',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/requests/remove")
.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/__admin/requests/remove',
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({
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/requests/remove',
headers: {'content-type': 'application/json'},
body: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
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}}/__admin/requests/remove');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
});
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}}/__admin/requests/remove',
headers: {'content-type': 'application/json'},
data: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/requests/remove';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""}'
};
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 = @{ @"basicAuthCredentials": @{ @"password": @"", @"username": @"" },
@"bodyPatterns": @[ @{ } ],
@"cookies": @{ },
@"headers": @{ },
@"method": @"",
@"queryParameters": @{ },
@"url": @"",
@"urlPath": @"",
@"urlPathPattern": @"",
@"urlPattern": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/requests/remove"]
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}}/__admin/requests/remove" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/requests/remove",
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([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]),
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}}/__admin/requests/remove', [
'body' => '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/requests/remove');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
]));
$request->setRequestUrl('{{baseUrl}}/__admin/requests/remove');
$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}}/__admin/requests/remove' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/requests/remove' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/requests/remove", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/requests/remove"
payload = {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [{}],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/requests/remove"
payload <- "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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}}/__admin/requests/remove")
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 \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\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/__admin/requests/remove') do |req|
req.body = "{\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/requests/remove";
let payload = json!({
"basicAuthCredentials": json!({
"password": "",
"username": ""
}),
"bodyPatterns": (json!({})),
"cookies": json!({}),
"headers": json!({}),
"method": "",
"queryParameters": json!({}),
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
});
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}}/__admin/requests/remove \
--header 'content-type: application/json' \
--data '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}'
echo '{
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}' | \
http POST {{baseUrl}}/__admin/requests/remove \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n}' \
--output-document \
- {{baseUrl}}/__admin/requests/remove
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"basicAuthCredentials": [
"password": "",
"username": ""
],
"bodyPatterns": [[]],
"cookies": [],
"headers": [],
"method": "",
"queryParameters": [],
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/requests/remove")! 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
{
"requests": [
{
"absoluteUrl": "http://mydomain.com/my/url",
"body": "",
"browserProxyRequest": true,
"headers": {
"Accept": "image/png,image/*;q=0.8,*/*;q=0.5",
"Accept-Language": "en-us,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "GET",
"url": "/my/url"
},
{
"absoluteUrl": "http://my.other.domain.com/my/other/url",
"body": "My text",
"browserProxyRequest": false,
"headers": {
"Accept": "text/plain",
"Content-Type": "text/plain"
},
"loggedDate": 1339083581823,
"loggedDateString": "2012-06-07 16:39:41",
"method": "POST",
"url": "/my/other/url"
}
]
}
GET
Get all scenarios
{{baseUrl}}/__admin/scenarios
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/scenarios");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/scenarios")
require "http/client"
url = "{{baseUrl}}/__admin/scenarios"
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}}/__admin/scenarios"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/scenarios");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/scenarios"
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/__admin/scenarios HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/scenarios")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/scenarios"))
.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}}/__admin/scenarios")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/scenarios")
.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}}/__admin/scenarios');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/__admin/scenarios'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/scenarios';
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}}/__admin/scenarios',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/scenarios")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/scenarios',
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}}/__admin/scenarios'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/scenarios');
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}}/__admin/scenarios'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/scenarios';
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}}/__admin/scenarios"]
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}}/__admin/scenarios" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/scenarios",
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}}/__admin/scenarios');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/scenarios');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/scenarios');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/scenarios' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/scenarios' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/scenarios")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/scenarios"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/scenarios"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/scenarios")
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/__admin/scenarios') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/scenarios";
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}}/__admin/scenarios
http GET {{baseUrl}}/__admin/scenarios
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/scenarios
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/scenarios")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Reset the state of all scenarios
{{baseUrl}}/__admin/scenarios/reset
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/scenarios/reset");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/scenarios/reset")
require "http/client"
url = "{{baseUrl}}/__admin/scenarios/reset"
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}}/__admin/scenarios/reset"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/scenarios/reset");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/scenarios/reset"
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/__admin/scenarios/reset HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/scenarios/reset")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/scenarios/reset"))
.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}}/__admin/scenarios/reset")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/scenarios/reset")
.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}}/__admin/scenarios/reset');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/scenarios/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/scenarios/reset';
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}}/__admin/scenarios/reset',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/scenarios/reset")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/scenarios/reset',
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}}/__admin/scenarios/reset'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/scenarios/reset');
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}}/__admin/scenarios/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/scenarios/reset';
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}}/__admin/scenarios/reset"]
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}}/__admin/scenarios/reset" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/scenarios/reset",
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}}/__admin/scenarios/reset');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/scenarios/reset');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/scenarios/reset');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/scenarios/reset' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/scenarios/reset' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/scenarios/reset")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/scenarios/reset"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/scenarios/reset"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/scenarios/reset")
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/__admin/scenarios/reset') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/scenarios/reset";
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}}/__admin/scenarios/reset
http POST {{baseUrl}}/__admin/scenarios/reset
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/scenarios/reset
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/scenarios/reset")! 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()
POST
Create a new stub mapping
{{baseUrl}}/__admin/mappings
BODY json
{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings");
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 \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/mappings" {:content-type :json
:form-params {:id ""
:metadata {}
:name ""
:newScenarioState ""
:persistent false
:postServeActions {}
:priority 0
:request {:basicAuthCredentials {:password ""
:username ""}
:bodyPatterns [{}]
:cookies {}
:headers {}
:method ""
:queryParameters {}
:url ""
:urlPath ""
:urlPathPattern ""
:urlPattern ""}
:requiredScenarioState ""
:response ""
:scenarioName ""
:uuid ""}})
require "http/client"
url = "{{baseUrl}}/__admin/mappings"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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}}/__admin/mappings"),
Content = new StringContent("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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}}/__admin/mappings");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings"
payload := strings.NewReader("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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/__admin/mappings HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 525
{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/mappings")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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 \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/mappings")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/mappings")
.header("content-type", "application/json")
.body("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/mappings');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/mappings',
headers: {'content-type': 'application/json'},
data: {
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","metadata":{},"name":"","newScenarioState":"","persistent":false,"postServeActions":{},"priority":0,"request":{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""},"requiredScenarioState":"","response":"","scenarioName":"","uuid":""}'
};
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}}/__admin/mappings',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": "",\n "metadata": {},\n "name": "",\n "newScenarioState": "",\n "persistent": false,\n "postServeActions": {},\n "priority": 0,\n "request": {\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n },\n "requiredScenarioState": "",\n "response": "",\n "scenarioName": "",\n "uuid": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings")
.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/__admin/mappings',
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({
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/mappings',
headers: {'content-type': 'application/json'},
body: {
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
},
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}}/__admin/mappings');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
});
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}}/__admin/mappings',
headers: {'content-type': 'application/json'},
data: {
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","metadata":{},"name":"","newScenarioState":"","persistent":false,"postServeActions":{},"priority":0,"request":{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""},"requiredScenarioState":"","response":"","scenarioName":"","uuid":""}'
};
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 = @{ @"id": @"",
@"metadata": @{ },
@"name": @"",
@"newScenarioState": @"",
@"persistent": @NO,
@"postServeActions": @{ },
@"priority": @0,
@"request": @{ @"basicAuthCredentials": @{ @"password": @"", @"username": @"" }, @"bodyPatterns": @[ @{ } ], @"cookies": @{ }, @"headers": @{ }, @"method": @"", @"queryParameters": @{ }, @"url": @"", @"urlPath": @"", @"urlPathPattern": @"", @"urlPattern": @"" },
@"requiredScenarioState": @"",
@"response": @"",
@"scenarioName": @"",
@"uuid": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/mappings"]
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}}/__admin/mappings" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings",
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([
'id' => '',
'metadata' => [
],
'name' => '',
'newScenarioState' => '',
'persistent' => null,
'postServeActions' => [
],
'priority' => 0,
'request' => [
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
],
'requiredScenarioState' => '',
'response' => '',
'scenarioName' => '',
'uuid' => ''
]),
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}}/__admin/mappings', [
'body' => '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => '',
'metadata' => [
],
'name' => '',
'newScenarioState' => '',
'persistent' => null,
'postServeActions' => [
],
'priority' => 0,
'request' => [
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
],
'requiredScenarioState' => '',
'response' => '',
'scenarioName' => '',
'uuid' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => '',
'metadata' => [
],
'name' => '',
'newScenarioState' => '',
'persistent' => null,
'postServeActions' => [
],
'priority' => 0,
'request' => [
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
],
'requiredScenarioState' => '',
'response' => '',
'scenarioName' => '',
'uuid' => ''
]));
$request->setRequestUrl('{{baseUrl}}/__admin/mappings');
$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}}/__admin/mappings' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/mappings", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings"
payload = {
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": False,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [{}],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings"
payload <- "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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}}/__admin/mappings")
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 \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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/__admin/mappings') do |req|
req.body = "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings";
let payload = json!({
"id": "",
"metadata": json!({}),
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": json!({}),
"priority": 0,
"request": json!({
"basicAuthCredentials": json!({
"password": "",
"username": ""
}),
"bodyPatterns": (json!({})),
"cookies": json!({}),
"headers": json!({}),
"method": "",
"queryParameters": json!({}),
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}),
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
});
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}}/__admin/mappings \
--header 'content-type: application/json' \
--data '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}'
echo '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}' | \
http POST {{baseUrl}}/__admin/mappings \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": "",\n "metadata": {},\n "name": "",\n "newScenarioState": "",\n "persistent": false,\n "postServeActions": {},\n "priority": 0,\n "request": {\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n },\n "requiredScenarioState": "",\n "response": "",\n "scenarioName": "",\n "uuid": ""\n}' \
--output-document \
- {{baseUrl}}/__admin/mappings
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": "",
"metadata": [],
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": [],
"priority": 0,
"request": [
"basicAuthCredentials": [
"password": "",
"username": ""
],
"bodyPatterns": [[]],
"cookies": [],
"headers": [],
"method": "",
"queryParameters": [],
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
],
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings")! 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
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"headers": {
"Accept": {
"equalTo": "text/plain"
}
},
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
}
DELETE
Delete a stub mapping
{{baseUrl}}/__admin/mappings/:stubMappingId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/:stubMappingId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/__admin/mappings/:stubMappingId")
require "http/client"
url = "{{baseUrl}}/__admin/mappings/:stubMappingId"
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}}/__admin/mappings/:stubMappingId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings/:stubMappingId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/:stubMappingId"
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/__admin/mappings/:stubMappingId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/__admin/mappings/:stubMappingId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/:stubMappingId"))
.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}}/__admin/mappings/:stubMappingId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/__admin/mappings/:stubMappingId")
.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}}/__admin/mappings/:stubMappingId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/__admin/mappings/:stubMappingId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/:stubMappingId';
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}}/__admin/mappings/:stubMappingId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/:stubMappingId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings/:stubMappingId',
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}}/__admin/mappings/:stubMappingId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/__admin/mappings/:stubMappingId');
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}}/__admin/mappings/:stubMappingId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/:stubMappingId';
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}}/__admin/mappings/:stubMappingId"]
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}}/__admin/mappings/:stubMappingId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/:stubMappingId",
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}}/__admin/mappings/:stubMappingId');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/:stubMappingId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings/:stubMappingId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings/:stubMappingId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/:stubMappingId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/__admin/mappings/:stubMappingId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/:stubMappingId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/:stubMappingId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings/:stubMappingId")
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/__admin/mappings/:stubMappingId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings/:stubMappingId";
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}}/__admin/mappings/:stubMappingId
http DELETE {{baseUrl}}/__admin/mappings/:stubMappingId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/__admin/mappings/:stubMappingId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/:stubMappingId")! 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()
DELETE
Delete all stub mappings
{{baseUrl}}/__admin/mappings
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/__admin/mappings")
require "http/client"
url = "{{baseUrl}}/__admin/mappings"
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}}/__admin/mappings"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings"
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/__admin/mappings HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/__admin/mappings")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings"))
.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}}/__admin/mappings")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/__admin/mappings")
.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}}/__admin/mappings');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/__admin/mappings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings';
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}}/__admin/mappings',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings',
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}}/__admin/mappings'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/__admin/mappings');
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}}/__admin/mappings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings';
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}}/__admin/mappings"]
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}}/__admin/mappings" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings",
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}}/__admin/mappings');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/__admin/mappings")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings")
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/__admin/mappings') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings";
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}}/__admin/mappings
http DELETE {{baseUrl}}/__admin/mappings
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/__admin/mappings
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings")! 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()
POST
Delete stub mappings matching metadata
{{baseUrl}}/__admin/mappings/remove-by-metadata
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/remove-by-metadata");
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 \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/mappings/remove-by-metadata" {:content-type :json
:form-params {:matchesJsonPath {:equalToJson "{ \"inner\": 42 }"
:expression "$.outer"}}})
require "http/client"
url = "{{baseUrl}}/__admin/mappings/remove-by-metadata"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\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}}/__admin/mappings/remove-by-metadata"),
Content = new StringContent("{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\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}}/__admin/mappings/remove-by-metadata");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/remove-by-metadata"
payload := strings.NewReader("{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\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/__admin/mappings/remove-by-metadata HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"matchesJsonPath": {
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/mappings/remove-by-metadata")
.setHeader("content-type", "application/json")
.setBody("{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/remove-by-metadata"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\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 \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/mappings/remove-by-metadata")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/mappings/remove-by-metadata")
.header("content-type", "application/json")
.body("{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}")
.asString();
const data = JSON.stringify({
matchesJsonPath: {
equalToJson: '{ "inner": 42 }',
expression: '$.outer'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/__admin/mappings/remove-by-metadata');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/mappings/remove-by-metadata',
headers: {'content-type': 'application/json'},
data: {matchesJsonPath: {equalToJson: '{ "inner": 42 }', expression: '$.outer'}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/remove-by-metadata';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"matchesJsonPath":{"equalToJson":"{ \"inner\": 42 }","expression":"$.outer"}}'
};
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}}/__admin/mappings/remove-by-metadata',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "matchesJsonPath": {\n "equalToJson": "{ \"inner\": 42 }",\n "expression": "$.outer"\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 \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/remove-by-metadata")
.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/__admin/mappings/remove-by-metadata',
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({matchesJsonPath: {equalToJson: '{ "inner": 42 }', expression: '$.outer'}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/mappings/remove-by-metadata',
headers: {'content-type': 'application/json'},
body: {matchesJsonPath: {equalToJson: '{ "inner": 42 }', expression: '$.outer'}},
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}}/__admin/mappings/remove-by-metadata');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
matchesJsonPath: {
equalToJson: '{ "inner": 42 }',
expression: '$.outer'
}
});
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}}/__admin/mappings/remove-by-metadata',
headers: {'content-type': 'application/json'},
data: {matchesJsonPath: {equalToJson: '{ "inner": 42 }', expression: '$.outer'}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/remove-by-metadata';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"matchesJsonPath":{"equalToJson":"{ \"inner\": 42 }","expression":"$.outer"}}'
};
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 = @{ @"matchesJsonPath": @{ @"equalToJson": @"{ \"inner\": 42 }", @"expression": @"$.outer" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/mappings/remove-by-metadata"]
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}}/__admin/mappings/remove-by-metadata" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/remove-by-metadata",
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([
'matchesJsonPath' => [
'equalToJson' => '{ "inner": 42 }',
'expression' => '$.outer'
]
]),
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}}/__admin/mappings/remove-by-metadata', [
'body' => '{
"matchesJsonPath": {
"equalToJson": "{ \\"inner\\": 42 }",
"expression": "$.outer"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/remove-by-metadata');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'matchesJsonPath' => [
'equalToJson' => '{ "inner": 42 }',
'expression' => '$.outer'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'matchesJsonPath' => [
'equalToJson' => '{ "inner": 42 }',
'expression' => '$.outer'
]
]));
$request->setRequestUrl('{{baseUrl}}/__admin/mappings/remove-by-metadata');
$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}}/__admin/mappings/remove-by-metadata' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"matchesJsonPath": {
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/remove-by-metadata' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"matchesJsonPath": {
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/__admin/mappings/remove-by-metadata", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/remove-by-metadata"
payload = { "matchesJsonPath": {
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/remove-by-metadata"
payload <- "{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\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}}/__admin/mappings/remove-by-metadata")
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 \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\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/__admin/mappings/remove-by-metadata') do |req|
req.body = "{\n \"matchesJsonPath\": {\n \"equalToJson\": \"{ \\\"inner\\\": 42 }\",\n \"expression\": \"$.outer\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings/remove-by-metadata";
let payload = json!({"matchesJsonPath": json!({
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
})});
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}}/__admin/mappings/remove-by-metadata \
--header 'content-type: application/json' \
--data '{
"matchesJsonPath": {
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
}
}'
echo '{
"matchesJsonPath": {
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
}
}' | \
http POST {{baseUrl}}/__admin/mappings/remove-by-metadata \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "matchesJsonPath": {\n "equalToJson": "{ \"inner\": 42 }",\n "expression": "$.outer"\n }\n}' \
--output-document \
- {{baseUrl}}/__admin/mappings/remove-by-metadata
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["matchesJsonPath": [
"equalToJson": "{ \"inner\": 42 }",
"expression": "$.outer"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/remove-by-metadata")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Find stubs by matching on their metadata
{{baseUrl}}/__admin/mappings/find-by-metadata
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/find-by-metadata");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/mappings/find-by-metadata")
require "http/client"
url = "{{baseUrl}}/__admin/mappings/find-by-metadata"
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}}/__admin/mappings/find-by-metadata"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings/find-by-metadata");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/find-by-metadata"
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/__admin/mappings/find-by-metadata HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/mappings/find-by-metadata")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/find-by-metadata"))
.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}}/__admin/mappings/find-by-metadata")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/mappings/find-by-metadata")
.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}}/__admin/mappings/find-by-metadata');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/__admin/mappings/find-by-metadata'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/find-by-metadata';
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}}/__admin/mappings/find-by-metadata',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/find-by-metadata")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings/find-by-metadata',
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}}/__admin/mappings/find-by-metadata'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/mappings/find-by-metadata');
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}}/__admin/mappings/find-by-metadata'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/find-by-metadata';
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}}/__admin/mappings/find-by-metadata"]
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}}/__admin/mappings/find-by-metadata" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/find-by-metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/__admin/mappings/find-by-metadata');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/find-by-metadata');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings/find-by-metadata');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings/find-by-metadata' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/find-by-metadata' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
conn.request("POST", "/baseUrl/__admin/mappings/find-by-metadata", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/find-by-metadata"
payload = ""
response = requests.post(url, data=payload)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/find-by-metadata"
payload <- ""
response <- VERB("POST", url, body = payload, content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings/find-by-metadata")
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/__admin/mappings/find-by-metadata') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings/find-by-metadata";
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}}/__admin/mappings/find-by-metadata
http POST {{baseUrl}}/__admin/mappings/find-by-metadata
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/mappings/find-by-metadata
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/find-by-metadata")! 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
{
"mappings": [
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"request": {
"headers": {
"Accept": {
"equalTo": "application/json"
}
},
"method": "GET",
"url": "/search?q=things"
},
"response": {
"headers": {
"Content-Type": "application/json"
},
"jsonBody": [
"thing1",
"thing2"
],
"status": 200
},
"uuid": "76ada7b0-49ae-4229-91c4-396a36f18e09"
},
{
"request": {
"bodyPatterns": [
{
"equalToXml": " "
}
],
"method": "POST",
"urlPath": "/some/things"
},
"response": {
"status": 201
}
}
],
"meta": {
"total": 2
}
}
GET
Get all stub mappings
{{baseUrl}}/__admin/mappings
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/mappings")
require "http/client"
url = "{{baseUrl}}/__admin/mappings"
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}}/__admin/mappings"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings"
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/__admin/mappings HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/mappings")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings"))
.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}}/__admin/mappings")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/mappings")
.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}}/__admin/mappings');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/__admin/mappings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings';
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}}/__admin/mappings',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings',
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}}/__admin/mappings'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/mappings');
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}}/__admin/mappings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings';
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}}/__admin/mappings"]
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}}/__admin/mappings" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings",
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}}/__admin/mappings');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/mappings")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings")
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/__admin/mappings') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings";
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}}/__admin/mappings
http GET {{baseUrl}}/__admin/mappings
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/mappings
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings")! 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
{
"mappings": [
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"request": {
"headers": {
"Accept": {
"equalTo": "application/json"
}
},
"method": "GET",
"url": "/search?q=things"
},
"response": {
"headers": {
"Content-Type": "application/json"
},
"jsonBody": [
"thing1",
"thing2"
],
"status": 200
},
"uuid": "76ada7b0-49ae-4229-91c4-396a36f18e09"
},
{
"request": {
"bodyPatterns": [
{
"equalToXml": " "
}
],
"method": "POST",
"urlPath": "/some/things"
},
"response": {
"status": 201
}
}
],
"meta": {
"total": 2
}
}
GET
Get stub mapping by ID
{{baseUrl}}/__admin/mappings/:stubMappingId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/:stubMappingId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/__admin/mappings/:stubMappingId")
require "http/client"
url = "{{baseUrl}}/__admin/mappings/:stubMappingId"
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}}/__admin/mappings/:stubMappingId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings/:stubMappingId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/:stubMappingId"
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/__admin/mappings/:stubMappingId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/__admin/mappings/:stubMappingId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/:stubMappingId"))
.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}}/__admin/mappings/:stubMappingId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/__admin/mappings/:stubMappingId")
.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}}/__admin/mappings/:stubMappingId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/__admin/mappings/:stubMappingId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/:stubMappingId';
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}}/__admin/mappings/:stubMappingId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/:stubMappingId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings/:stubMappingId',
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}}/__admin/mappings/:stubMappingId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/__admin/mappings/:stubMappingId');
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}}/__admin/mappings/:stubMappingId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/:stubMappingId';
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}}/__admin/mappings/:stubMappingId"]
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}}/__admin/mappings/:stubMappingId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/:stubMappingId",
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}}/__admin/mappings/:stubMappingId');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/:stubMappingId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings/:stubMappingId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings/:stubMappingId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/:stubMappingId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/__admin/mappings/:stubMappingId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/:stubMappingId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/:stubMappingId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings/:stubMappingId")
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/__admin/mappings/:stubMappingId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings/:stubMappingId";
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}}/__admin/mappings/:stubMappingId
http GET {{baseUrl}}/__admin/mappings/:stubMappingId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/__admin/mappings/:stubMappingId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/:stubMappingId")! 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
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"headers": {
"Accept": {
"equalTo": "text/plain"
}
},
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
}
POST
Import stub mappings
{{baseUrl}}/__admin/mappings/import
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/import");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/mappings/import")
require "http/client"
url = "{{baseUrl}}/__admin/mappings/import"
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}}/__admin/mappings/import"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings/import");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/import"
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/__admin/mappings/import HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/mappings/import")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/import"))
.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}}/__admin/mappings/import")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/mappings/import")
.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}}/__admin/mappings/import');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/mappings/import'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/import';
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}}/__admin/mappings/import',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/import")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings/import',
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}}/__admin/mappings/import'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/mappings/import');
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}}/__admin/mappings/import'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/import';
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}}/__admin/mappings/import"]
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}}/__admin/mappings/import" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/import",
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}}/__admin/mappings/import');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/import');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings/import');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings/import' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/import' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/mappings/import")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/import"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/import"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings/import")
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/__admin/mappings/import') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings/import";
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}}/__admin/mappings/import
http POST {{baseUrl}}/__admin/mappings/import
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/mappings/import
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/import")! 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()
POST
Persist stub mappings
{{baseUrl}}/__admin/mappings/save
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/save");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/mappings/save")
require "http/client"
url = "{{baseUrl}}/__admin/mappings/save"
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}}/__admin/mappings/save"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings/save");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/save"
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/__admin/mappings/save HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/mappings/save")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/save"))
.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}}/__admin/mappings/save")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/mappings/save")
.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}}/__admin/mappings/save');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/mappings/save'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/save';
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}}/__admin/mappings/save',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/save")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings/save',
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}}/__admin/mappings/save'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/mappings/save');
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}}/__admin/mappings/save'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/save';
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}}/__admin/mappings/save"]
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}}/__admin/mappings/save" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/save",
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}}/__admin/mappings/save');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/save');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings/save');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings/save' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/save' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/mappings/save")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/save"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/save"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings/save")
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/__admin/mappings/save') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings/save";
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}}/__admin/mappings/save
http POST {{baseUrl}}/__admin/mappings/save
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/mappings/save
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/save")! 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()
POST
Reset stub mappings
{{baseUrl}}/__admin/mappings/reset
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/reset");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/mappings/reset")
require "http/client"
url = "{{baseUrl}}/__admin/mappings/reset"
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}}/__admin/mappings/reset"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/mappings/reset");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/reset"
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/__admin/mappings/reset HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/mappings/reset")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/reset"))
.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}}/__admin/mappings/reset")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/mappings/reset")
.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}}/__admin/mappings/reset');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/mappings/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/reset';
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}}/__admin/mappings/reset',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/reset")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/mappings/reset',
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}}/__admin/mappings/reset'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/mappings/reset');
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}}/__admin/mappings/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/reset';
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}}/__admin/mappings/reset"]
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}}/__admin/mappings/reset" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/reset",
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}}/__admin/mappings/reset');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/reset');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/mappings/reset');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/mappings/reset' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/reset' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/mappings/reset")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/reset"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/reset"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/mappings/reset")
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/__admin/mappings/reset') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/mappings/reset";
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}}/__admin/mappings/reset
http POST {{baseUrl}}/__admin/mappings/reset
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/mappings/reset
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/reset")! 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()
PUT
Update a stub mapping
{{baseUrl}}/__admin/mappings/:stubMappingId
BODY json
{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/mappings/:stubMappingId");
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 \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/__admin/mappings/:stubMappingId" {:content-type :json
:form-params {:id ""
:metadata {}
:name ""
:newScenarioState ""
:persistent false
:postServeActions {}
:priority 0
:request {:basicAuthCredentials {:password ""
:username ""}
:bodyPatterns [{}]
:cookies {}
:headers {}
:method ""
:queryParameters {}
:url ""
:urlPath ""
:urlPathPattern ""
:urlPattern ""}
:requiredScenarioState ""
:response ""
:scenarioName ""
:uuid ""}})
require "http/client"
url = "{{baseUrl}}/__admin/mappings/:stubMappingId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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}}/__admin/mappings/:stubMappingId"),
Content = new StringContent("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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}}/__admin/mappings/:stubMappingId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/mappings/:stubMappingId"
payload := strings.NewReader("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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/__admin/mappings/:stubMappingId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 525
{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/__admin/mappings/:stubMappingId")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/mappings/:stubMappingId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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 \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/__admin/mappings/:stubMappingId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/__admin/mappings/:stubMappingId")
.header("content-type", "application/json")
.body("{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/__admin/mappings/:stubMappingId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/__admin/mappings/:stubMappingId',
headers: {'content-type': 'application/json'},
data: {
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/mappings/:stubMappingId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":"","metadata":{},"name":"","newScenarioState":"","persistent":false,"postServeActions":{},"priority":0,"request":{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""},"requiredScenarioState":"","response":"","scenarioName":"","uuid":""}'
};
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}}/__admin/mappings/:stubMappingId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": "",\n "metadata": {},\n "name": "",\n "newScenarioState": "",\n "persistent": false,\n "postServeActions": {},\n "priority": 0,\n "request": {\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n },\n "requiredScenarioState": "",\n "response": "",\n "scenarioName": "",\n "uuid": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/__admin/mappings/:stubMappingId")
.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/__admin/mappings/:stubMappingId',
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({
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/__admin/mappings/:stubMappingId',
headers: {'content-type': 'application/json'},
body: {
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
},
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}}/__admin/mappings/:stubMappingId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {
password: '',
username: ''
},
bodyPatterns: [
{}
],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
});
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}}/__admin/mappings/:stubMappingId',
headers: {'content-type': 'application/json'},
data: {
id: '',
metadata: {},
name: '',
newScenarioState: '',
persistent: false,
postServeActions: {},
priority: 0,
request: {
basicAuthCredentials: {password: '', username: ''},
bodyPatterns: [{}],
cookies: {},
headers: {},
method: '',
queryParameters: {},
url: '',
urlPath: '',
urlPathPattern: '',
urlPattern: ''
},
requiredScenarioState: '',
response: '',
scenarioName: '',
uuid: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/mappings/:stubMappingId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":"","metadata":{},"name":"","newScenarioState":"","persistent":false,"postServeActions":{},"priority":0,"request":{"basicAuthCredentials":{"password":"","username":""},"bodyPatterns":[{}],"cookies":{},"headers":{},"method":"","queryParameters":{},"url":"","urlPath":"","urlPathPattern":"","urlPattern":""},"requiredScenarioState":"","response":"","scenarioName":"","uuid":""}'
};
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 = @{ @"id": @"",
@"metadata": @{ },
@"name": @"",
@"newScenarioState": @"",
@"persistent": @NO,
@"postServeActions": @{ },
@"priority": @0,
@"request": @{ @"basicAuthCredentials": @{ @"password": @"", @"username": @"" }, @"bodyPatterns": @[ @{ } ], @"cookies": @{ }, @"headers": @{ }, @"method": @"", @"queryParameters": @{ }, @"url": @"", @"urlPath": @"", @"urlPathPattern": @"", @"urlPattern": @"" },
@"requiredScenarioState": @"",
@"response": @"",
@"scenarioName": @"",
@"uuid": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/__admin/mappings/:stubMappingId"]
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}}/__admin/mappings/:stubMappingId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/mappings/:stubMappingId",
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([
'id' => '',
'metadata' => [
],
'name' => '',
'newScenarioState' => '',
'persistent' => null,
'postServeActions' => [
],
'priority' => 0,
'request' => [
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
],
'requiredScenarioState' => '',
'response' => '',
'scenarioName' => '',
'uuid' => ''
]),
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}}/__admin/mappings/:stubMappingId', [
'body' => '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/mappings/:stubMappingId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => '',
'metadata' => [
],
'name' => '',
'newScenarioState' => '',
'persistent' => null,
'postServeActions' => [
],
'priority' => 0,
'request' => [
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
],
'requiredScenarioState' => '',
'response' => '',
'scenarioName' => '',
'uuid' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => '',
'metadata' => [
],
'name' => '',
'newScenarioState' => '',
'persistent' => null,
'postServeActions' => [
],
'priority' => 0,
'request' => [
'basicAuthCredentials' => [
'password' => '',
'username' => ''
],
'bodyPatterns' => [
[
]
],
'cookies' => [
],
'headers' => [
],
'method' => '',
'queryParameters' => [
],
'url' => '',
'urlPath' => '',
'urlPathPattern' => '',
'urlPattern' => ''
],
'requiredScenarioState' => '',
'response' => '',
'scenarioName' => '',
'uuid' => ''
]));
$request->setRequestUrl('{{baseUrl}}/__admin/mappings/:stubMappingId');
$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}}/__admin/mappings/:stubMappingId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/mappings/:stubMappingId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/__admin/mappings/:stubMappingId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/mappings/:stubMappingId"
payload = {
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": False,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [{}],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/mappings/:stubMappingId"
payload <- "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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}}/__admin/mappings/:stubMappingId")
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 \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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/__admin/mappings/:stubMappingId') do |req|
req.body = "{\n \"id\": \"\",\n \"metadata\": {},\n \"name\": \"\",\n \"newScenarioState\": \"\",\n \"persistent\": false,\n \"postServeActions\": {},\n \"priority\": 0,\n \"request\": {\n \"basicAuthCredentials\": {\n \"password\": \"\",\n \"username\": \"\"\n },\n \"bodyPatterns\": [\n {}\n ],\n \"cookies\": {},\n \"headers\": {},\n \"method\": \"\",\n \"queryParameters\": {},\n \"url\": \"\",\n \"urlPath\": \"\",\n \"urlPathPattern\": \"\",\n \"urlPattern\": \"\"\n },\n \"requiredScenarioState\": \"\",\n \"response\": \"\",\n \"scenarioName\": \"\",\n \"uuid\": \"\"\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}}/__admin/mappings/:stubMappingId";
let payload = json!({
"id": "",
"metadata": json!({}),
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": json!({}),
"priority": 0,
"request": json!({
"basicAuthCredentials": json!({
"password": "",
"username": ""
}),
"bodyPatterns": (json!({})),
"cookies": json!({}),
"headers": json!({}),
"method": "",
"queryParameters": json!({}),
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
}),
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
});
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}}/__admin/mappings/:stubMappingId \
--header 'content-type: application/json' \
--data '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}'
echo '{
"id": "",
"metadata": {},
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": {},
"priority": 0,
"request": {
"basicAuthCredentials": {
"password": "",
"username": ""
},
"bodyPatterns": [
{}
],
"cookies": {},
"headers": {},
"method": "",
"queryParameters": {},
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
},
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
}' | \
http PUT {{baseUrl}}/__admin/mappings/:stubMappingId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": "",\n "metadata": {},\n "name": "",\n "newScenarioState": "",\n "persistent": false,\n "postServeActions": {},\n "priority": 0,\n "request": {\n "basicAuthCredentials": {\n "password": "",\n "username": ""\n },\n "bodyPatterns": [\n {}\n ],\n "cookies": {},\n "headers": {},\n "method": "",\n "queryParameters": {},\n "url": "",\n "urlPath": "",\n "urlPathPattern": "",\n "urlPattern": ""\n },\n "requiredScenarioState": "",\n "response": "",\n "scenarioName": "",\n "uuid": ""\n}' \
--output-document \
- {{baseUrl}}/__admin/mappings/:stubMappingId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": "",
"metadata": [],
"name": "",
"newScenarioState": "",
"persistent": false,
"postServeActions": [],
"priority": 0,
"request": [
"basicAuthCredentials": [
"password": "",
"username": ""
],
"bodyPatterns": [[]],
"cookies": [],
"headers": [],
"method": "",
"queryParameters": [],
"url": "",
"urlPath": "",
"urlPathPattern": "",
"urlPattern": ""
],
"requiredScenarioState": "",
"response": "",
"scenarioName": "",
"uuid": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/mappings/:stubMappingId")! 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
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"headers": {
"Accept": {
"equalTo": "text/plain"
}
},
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
}
POST
Reset mappings and request journal
{{baseUrl}}/__admin/reset
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/reset");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/reset")
require "http/client"
url = "{{baseUrl}}/__admin/reset"
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}}/__admin/reset"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/reset");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/reset"
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/__admin/reset HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/reset")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/reset"))
.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}}/__admin/reset")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/reset")
.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}}/__admin/reset');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/reset';
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}}/__admin/reset',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/reset")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/reset',
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}}/__admin/reset'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/reset');
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}}/__admin/reset'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/reset';
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}}/__admin/reset"]
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}}/__admin/reset" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/reset",
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}}/__admin/reset');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/reset');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/reset');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/reset' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/reset' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/reset")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/reset"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/reset"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/reset")
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/__admin/reset') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/reset";
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}}/__admin/reset
http POST {{baseUrl}}/__admin/reset
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/reset
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/reset")! 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()
POST
Shutdown the WireMock server
{{baseUrl}}/__admin/shutdown
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/shutdown");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/shutdown")
require "http/client"
url = "{{baseUrl}}/__admin/shutdown"
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}}/__admin/shutdown"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/shutdown");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/shutdown"
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/__admin/shutdown HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/shutdown")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/shutdown"))
.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}}/__admin/shutdown")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/shutdown")
.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}}/__admin/shutdown');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/shutdown'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/shutdown';
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}}/__admin/shutdown',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/shutdown")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/shutdown',
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}}/__admin/shutdown'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/shutdown');
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}}/__admin/shutdown'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/shutdown';
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}}/__admin/shutdown"]
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}}/__admin/shutdown" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/shutdown",
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}}/__admin/shutdown');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/shutdown');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/shutdown');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/shutdown' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/shutdown' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/shutdown")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/shutdown"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/shutdown"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/shutdown")
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/__admin/shutdown') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/shutdown";
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}}/__admin/shutdown
http POST {{baseUrl}}/__admin/shutdown
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/shutdown
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/shutdown")! 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()
POST
Update global settings
{{baseUrl}}/__admin/settings
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/__admin/settings");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/__admin/settings")
require "http/client"
url = "{{baseUrl}}/__admin/settings"
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}}/__admin/settings"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/__admin/settings");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/__admin/settings"
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/__admin/settings HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/__admin/settings")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/__admin/settings"))
.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}}/__admin/settings")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/__admin/settings")
.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}}/__admin/settings');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/__admin/settings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/__admin/settings';
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}}/__admin/settings',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/__admin/settings")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/__admin/settings',
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}}/__admin/settings'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/__admin/settings');
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}}/__admin/settings'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/__admin/settings';
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}}/__admin/settings"]
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}}/__admin/settings" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/__admin/settings",
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}}/__admin/settings');
echo $response->getBody();
setUrl('{{baseUrl}}/__admin/settings');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/__admin/settings');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/__admin/settings' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/__admin/settings' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/__admin/settings")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/__admin/settings"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/__admin/settings"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/__admin/settings")
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/__admin/settings') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/__admin/settings";
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}}/__admin/settings
http POST {{baseUrl}}/__admin/settings
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/__admin/settings
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/__admin/settings")! 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()