nullable-optional
POST
nullableOptional_createComplexProfile
{{baseUrl}}/api/profiles/complex
BODY json
{
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/profiles/complex");
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 \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api/profiles/complex" {:content-type :json
:form-params {:id ""
:nullableRole ""
:optionalRole ""
:optionalNullableRole ""
:nullableStatus ""
:optionalStatus ""
:optionalNullableStatus ""
:nullableNotification ""
:optionalNotification ""
:optionalNullableNotification ""
:nullableSearchResult ""
:optionalSearchResult ""
:nullableArray []
:optionalArray []
:optionalNullableArray []
:nullableListOfNullables []
:nullableMapOfNullables {}
:nullableListOfUnions []
:optionalMapOfEnums {}}})
require "http/client"
url = "{{baseUrl}}/api/profiles/complex"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\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}}/api/profiles/complex"),
Content = new StringContent("{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\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}}/api/profiles/complex");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/profiles/complex"
payload := strings.NewReader("{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\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/api/profiles/complex HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 526
{
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api/profiles/complex")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/profiles/complex"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\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 \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api/profiles/complex")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api/profiles/complex")
.header("content-type", "application/json")
.body("{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}")
.asString();
const data = JSON.stringify({
id: '',
nullableRole: '',
optionalRole: '',
optionalNullableRole: '',
nullableStatus: '',
optionalStatus: '',
optionalNullableStatus: '',
nullableNotification: '',
optionalNotification: '',
optionalNullableNotification: '',
nullableSearchResult: '',
optionalSearchResult: '',
nullableArray: [],
optionalArray: [],
optionalNullableArray: [],
nullableListOfNullables: [],
nullableMapOfNullables: {},
nullableListOfUnions: [],
optionalMapOfEnums: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api/profiles/complex');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api/profiles/complex',
headers: {'content-type': 'application/json'},
data: {
id: '',
nullableRole: '',
optionalRole: '',
optionalNullableRole: '',
nullableStatus: '',
optionalStatus: '',
optionalNullableStatus: '',
nullableNotification: '',
optionalNotification: '',
optionalNullableNotification: '',
nullableSearchResult: '',
optionalSearchResult: '',
nullableArray: [],
optionalArray: [],
optionalNullableArray: [],
nullableListOfNullables: [],
nullableMapOfNullables: {},
nullableListOfUnions: [],
optionalMapOfEnums: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/profiles/complex';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","nullableRole":"","optionalRole":"","optionalNullableRole":"","nullableStatus":"","optionalStatus":"","optionalNullableStatus":"","nullableNotification":"","optionalNotification":"","optionalNullableNotification":"","nullableSearchResult":"","optionalSearchResult":"","nullableArray":[],"optionalArray":[],"optionalNullableArray":[],"nullableListOfNullables":[],"nullableMapOfNullables":{},"nullableListOfUnions":[],"optionalMapOfEnums":{}}'
};
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}}/api/profiles/complex',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": "",\n "nullableRole": "",\n "optionalRole": "",\n "optionalNullableRole": "",\n "nullableStatus": "",\n "optionalStatus": "",\n "optionalNullableStatus": "",\n "nullableNotification": "",\n "optionalNotification": "",\n "optionalNullableNotification": "",\n "nullableSearchResult": "",\n "optionalSearchResult": "",\n "nullableArray": [],\n "optionalArray": [],\n "optionalNullableArray": [],\n "nullableListOfNullables": [],\n "nullableMapOfNullables": {},\n "nullableListOfUnions": [],\n "optionalMapOfEnums": {}\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 \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api/profiles/complex")
.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/api/profiles/complex',
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: '',
nullableRole: '',
optionalRole: '',
optionalNullableRole: '',
nullableStatus: '',
optionalStatus: '',
optionalNullableStatus: '',
nullableNotification: '',
optionalNotification: '',
optionalNullableNotification: '',
nullableSearchResult: '',
optionalSearchResult: '',
nullableArray: [],
optionalArray: [],
optionalNullableArray: [],
nullableListOfNullables: [],
nullableMapOfNullables: {},
nullableListOfUnions: [],
optionalMapOfEnums: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api/profiles/complex',
headers: {'content-type': 'application/json'},
body: {
id: '',
nullableRole: '',
optionalRole: '',
optionalNullableRole: '',
nullableStatus: '',
optionalStatus: '',
optionalNullableStatus: '',
nullableNotification: '',
optionalNotification: '',
optionalNullableNotification: '',
nullableSearchResult: '',
optionalSearchResult: '',
nullableArray: [],
optionalArray: [],
optionalNullableArray: [],
nullableListOfNullables: [],
nullableMapOfNullables: {},
nullableListOfUnions: [],
optionalMapOfEnums: {}
},
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}}/api/profiles/complex');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: '',
nullableRole: '',
optionalRole: '',
optionalNullableRole: '',
nullableStatus: '',
optionalStatus: '',
optionalNullableStatus: '',
nullableNotification: '',
optionalNotification: '',
optionalNullableNotification: '',
nullableSearchResult: '',
optionalSearchResult: '',
nullableArray: [],
optionalArray: [],
optionalNullableArray: [],
nullableListOfNullables: [],
nullableMapOfNullables: {},
nullableListOfUnions: [],
optionalMapOfEnums: {}
});
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}}/api/profiles/complex',
headers: {'content-type': 'application/json'},
data: {
id: '',
nullableRole: '',
optionalRole: '',
optionalNullableRole: '',
nullableStatus: '',
optionalStatus: '',
optionalNullableStatus: '',
nullableNotification: '',
optionalNotification: '',
optionalNullableNotification: '',
nullableSearchResult: '',
optionalSearchResult: '',
nullableArray: [],
optionalArray: [],
optionalNullableArray: [],
nullableListOfNullables: [],
nullableMapOfNullables: {},
nullableListOfUnions: [],
optionalMapOfEnums: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/profiles/complex';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","nullableRole":"","optionalRole":"","optionalNullableRole":"","nullableStatus":"","optionalStatus":"","optionalNullableStatus":"","nullableNotification":"","optionalNotification":"","optionalNullableNotification":"","nullableSearchResult":"","optionalSearchResult":"","nullableArray":[],"optionalArray":[],"optionalNullableArray":[],"nullableListOfNullables":[],"nullableMapOfNullables":{},"nullableListOfUnions":[],"optionalMapOfEnums":{}}'
};
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": @"",
@"nullableRole": @"",
@"optionalRole": @"",
@"optionalNullableRole": @"",
@"nullableStatus": @"",
@"optionalStatus": @"",
@"optionalNullableStatus": @"",
@"nullableNotification": @"",
@"optionalNotification": @"",
@"optionalNullableNotification": @"",
@"nullableSearchResult": @"",
@"optionalSearchResult": @"",
@"nullableArray": @[ ],
@"optionalArray": @[ ],
@"optionalNullableArray": @[ ],
@"nullableListOfNullables": @[ ],
@"nullableMapOfNullables": @{ },
@"nullableListOfUnions": @[ ],
@"optionalMapOfEnums": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api/profiles/complex"]
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}}/api/profiles/complex" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/profiles/complex",
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' => '',
'nullableRole' => '',
'optionalRole' => '',
'optionalNullableRole' => '',
'nullableStatus' => '',
'optionalStatus' => '',
'optionalNullableStatus' => '',
'nullableNotification' => '',
'optionalNotification' => '',
'optionalNullableNotification' => '',
'nullableSearchResult' => '',
'optionalSearchResult' => '',
'nullableArray' => [
],
'optionalArray' => [
],
'optionalNullableArray' => [
],
'nullableListOfNullables' => [
],
'nullableMapOfNullables' => [
],
'nullableListOfUnions' => [
],
'optionalMapOfEnums' => [
]
]),
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}}/api/profiles/complex', [
'body' => '{
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api/profiles/complex');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => '',
'nullableRole' => '',
'optionalRole' => '',
'optionalNullableRole' => '',
'nullableStatus' => '',
'optionalStatus' => '',
'optionalNullableStatus' => '',
'nullableNotification' => '',
'optionalNotification' => '',
'optionalNullableNotification' => '',
'nullableSearchResult' => '',
'optionalSearchResult' => '',
'nullableArray' => [
],
'optionalArray' => [
],
'optionalNullableArray' => [
],
'nullableListOfNullables' => [
],
'nullableMapOfNullables' => [
],
'nullableListOfUnions' => [
],
'optionalMapOfEnums' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => '',
'nullableRole' => '',
'optionalRole' => '',
'optionalNullableRole' => '',
'nullableStatus' => '',
'optionalStatus' => '',
'optionalNullableStatus' => '',
'nullableNotification' => '',
'optionalNotification' => '',
'optionalNullableNotification' => '',
'nullableSearchResult' => '',
'optionalSearchResult' => '',
'nullableArray' => [
],
'optionalArray' => [
],
'optionalNullableArray' => [
],
'nullableListOfNullables' => [
],
'nullableMapOfNullables' => [
],
'nullableListOfUnions' => [
],
'optionalMapOfEnums' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/api/profiles/complex');
$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}}/api/profiles/complex' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/profiles/complex' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/api/profiles/complex", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/profiles/complex"
payload = {
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/profiles/complex"
payload <- "{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\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}}/api/profiles/complex")
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 \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\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/api/profiles/complex') do |req|
req.body = "{\n \"id\": \"\",\n \"nullableRole\": \"\",\n \"optionalRole\": \"\",\n \"optionalNullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"optionalStatus\": \"\",\n \"optionalNullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"optionalNotification\": \"\",\n \"optionalNullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"optionalSearchResult\": \"\",\n \"nullableArray\": [],\n \"optionalArray\": [],\n \"optionalNullableArray\": [],\n \"nullableListOfNullables\": [],\n \"nullableMapOfNullables\": {},\n \"nullableListOfUnions\": [],\n \"optionalMapOfEnums\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/profiles/complex";
let payload = json!({
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": (),
"optionalArray": (),
"optionalNullableArray": (),
"nullableListOfNullables": (),
"nullableMapOfNullables": json!({}),
"nullableListOfUnions": (),
"optionalMapOfEnums": 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}}/api/profiles/complex \
--header 'content-type: application/json' \
--data '{
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}'
echo '{
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": {},
"nullableListOfUnions": [],
"optionalMapOfEnums": {}
}' | \
http POST {{baseUrl}}/api/profiles/complex \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": "",\n "nullableRole": "",\n "optionalRole": "",\n "optionalNullableRole": "",\n "nullableStatus": "",\n "optionalStatus": "",\n "optionalNullableStatus": "",\n "nullableNotification": "",\n "optionalNotification": "",\n "optionalNullableNotification": "",\n "nullableSearchResult": "",\n "optionalSearchResult": "",\n "nullableArray": [],\n "optionalArray": [],\n "optionalNullableArray": [],\n "nullableListOfNullables": [],\n "nullableMapOfNullables": {},\n "nullableListOfUnions": [],\n "optionalMapOfEnums": {}\n}' \
--output-document \
- {{baseUrl}}/api/profiles/complex
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": "",
"nullableRole": "",
"optionalRole": "",
"optionalNullableRole": "",
"nullableStatus": "",
"optionalStatus": "",
"optionalNullableStatus": "",
"nullableNotification": "",
"optionalNotification": "",
"optionalNullableNotification": "",
"nullableSearchResult": "",
"optionalSearchResult": "",
"nullableArray": [],
"optionalArray": [],
"optionalNullableArray": [],
"nullableListOfNullables": [],
"nullableMapOfNullables": [],
"nullableListOfUnions": [],
"optionalMapOfEnums": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/profiles/complex")! 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
nullableOptional_createUser
{{baseUrl}}/api/users
BODY json
{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users");
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 \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api/users" {:content-type :json
:form-params {:username ""
:email ""
:phone ""
:address {:street ""
:city ""
:state ""
:zipCode ""
:country ""
:buildingId ""
:tenantId ""}}})
require "http/client"
url = "{{baseUrl}}/api/users"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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}}/api/users"),
Content = new StringContent("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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}}/api/users");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users"
payload := strings.NewReader("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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/api/users HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 200
{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api/users")
.setHeader("content-type", "application/json")
.setBody("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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 \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api/users")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api/users")
.header("content-type", "application/json")
.body("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api/users');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api/users',
headers: {'content-type': 'application/json'},
data: {
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","email":"","phone":"","address":{"street":"","city":"","state":"","zipCode":"","country":"","buildingId":"","tenantId":""}}'
};
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}}/api/users',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "username": "",\n "email": "",\n "phone": "",\n "address": {\n "street": "",\n "city": "",\n "state": "",\n "zipCode": "",\n "country": "",\n "buildingId": "",\n "tenantId": ""\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 \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api/users")
.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/api/users',
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({
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api/users',
headers: {'content-type': 'application/json'},
body: {
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
},
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}}/api/users');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
});
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}}/api/users',
headers: {'content-type': 'application/json'},
data: {
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","email":"","phone":"","address":{"street":"","city":"","state":"","zipCode":"","country":"","buildingId":"","tenantId":""}}'
};
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 = @{ @"username": @"",
@"email": @"",
@"phone": @"",
@"address": @{ @"street": @"", @"city": @"", @"state": @"", @"zipCode": @"", @"country": @"", @"buildingId": @"", @"tenantId": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api/users"]
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}}/api/users" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users",
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([
'username' => '',
'email' => '',
'phone' => '',
'address' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
]
]),
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}}/api/users', [
'body' => '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api/users');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'username' => '',
'email' => '',
'phone' => '',
'address' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'username' => '',
'email' => '',
'phone' => '',
'address' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/api/users');
$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}}/api/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/api/users", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users"
payload = {
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users"
payload <- "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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}}/api/users")
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 \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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/api/users') do |req|
req.body = "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/users";
let payload = json!({
"username": "",
"email": "",
"phone": "",
"address": json!({
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
})
});
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}}/api/users \
--header 'content-type: application/json' \
--data '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}'
echo '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}' | \
http POST {{baseUrl}}/api/users \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "username": "",\n "email": "",\n "phone": "",\n "address": {\n "street": "",\n "city": "",\n "state": "",\n "zipCode": "",\n "country": "",\n "buildingId": "",\n "tenantId": ""\n }\n}' \
--output-document \
- {{baseUrl}}/api/users
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"username": "",
"email": "",
"phone": "",
"address": [
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
nullableOptional_filterByRole
{{baseUrl}}/api/users/filter
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users/filter");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api/users/filter")
require "http/client"
url = "{{baseUrl}}/api/users/filter"
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}}/api/users/filter"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api/users/filter");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users/filter"
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/api/users/filter HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api/users/filter")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users/filter"))
.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}}/api/users/filter")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api/users/filter")
.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}}/api/users/filter');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api/users/filter'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users/filter';
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}}/api/users/filter',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api/users/filter")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/users/filter',
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}}/api/users/filter'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api/users/filter');
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}}/api/users/filter'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users/filter';
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}}/api/users/filter"]
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}}/api/users/filter" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users/filter",
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}}/api/users/filter');
echo $response->getBody();
setUrl('{{baseUrl}}/api/users/filter');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api/users/filter');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/users/filter' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users/filter' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api/users/filter")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users/filter"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users/filter"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/users/filter")
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/api/users/filter') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/users/filter";
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}}/api/users/filter
http GET {{baseUrl}}/api/users/filter
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api/users/filter
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users/filter")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
nullableOptional_getComplexProfile
{{baseUrl}}/api/profiles/complex/:profileId
QUERY PARAMS
profileId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/profiles/complex/:profileId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api/profiles/complex/:profileId")
require "http/client"
url = "{{baseUrl}}/api/profiles/complex/:profileId"
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}}/api/profiles/complex/:profileId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api/profiles/complex/:profileId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/profiles/complex/:profileId"
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/api/profiles/complex/:profileId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api/profiles/complex/:profileId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/profiles/complex/:profileId"))
.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}}/api/profiles/complex/:profileId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api/profiles/complex/:profileId")
.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}}/api/profiles/complex/:profileId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api/profiles/complex/:profileId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/profiles/complex/:profileId';
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}}/api/profiles/complex/:profileId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api/profiles/complex/:profileId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/profiles/complex/:profileId',
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}}/api/profiles/complex/:profileId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api/profiles/complex/:profileId');
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}}/api/profiles/complex/:profileId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/profiles/complex/:profileId';
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}}/api/profiles/complex/:profileId"]
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}}/api/profiles/complex/:profileId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/profiles/complex/:profileId",
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}}/api/profiles/complex/:profileId');
echo $response->getBody();
setUrl('{{baseUrl}}/api/profiles/complex/:profileId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api/profiles/complex/:profileId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/profiles/complex/:profileId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/profiles/complex/:profileId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api/profiles/complex/:profileId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/profiles/complex/:profileId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/profiles/complex/:profileId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/profiles/complex/:profileId")
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/api/profiles/complex/:profileId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/profiles/complex/:profileId";
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}}/api/profiles/complex/:profileId
http GET {{baseUrl}}/api/profiles/complex/:profileId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api/profiles/complex/:profileId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/profiles/complex/:profileId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
nullableOptional_getNotificationSettings
{{baseUrl}}/api/users/:userId/notifications
QUERY PARAMS
userId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users/:userId/notifications");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api/users/:userId/notifications")
require "http/client"
url = "{{baseUrl}}/api/users/:userId/notifications"
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}}/api/users/:userId/notifications"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api/users/:userId/notifications");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users/:userId/notifications"
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/api/users/:userId/notifications HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api/users/:userId/notifications")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users/:userId/notifications"))
.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}}/api/users/:userId/notifications")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api/users/:userId/notifications")
.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}}/api/users/:userId/notifications');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api/users/:userId/notifications'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users/:userId/notifications';
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}}/api/users/:userId/notifications',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api/users/:userId/notifications")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/users/:userId/notifications',
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}}/api/users/:userId/notifications'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api/users/:userId/notifications');
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}}/api/users/:userId/notifications'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users/:userId/notifications';
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}}/api/users/:userId/notifications"]
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}}/api/users/:userId/notifications" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users/:userId/notifications",
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}}/api/users/:userId/notifications');
echo $response->getBody();
setUrl('{{baseUrl}}/api/users/:userId/notifications');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api/users/:userId/notifications');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/users/:userId/notifications' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users/:userId/notifications' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api/users/:userId/notifications")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users/:userId/notifications"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users/:userId/notifications"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/users/:userId/notifications")
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/api/users/:userId/notifications') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/users/:userId/notifications";
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}}/api/users/:userId/notifications
http GET {{baseUrl}}/api/users/:userId/notifications
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api/users/:userId/notifications
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users/:userId/notifications")! 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
nullableOptional_getSearchResults
{{baseUrl}}/api/search
BODY json
{
"query": "",
"filters": {},
"includeTypes": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/search");
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 \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api/search" {:content-type :json
:form-params {:query ""
:filters {}
:includeTypes []}})
require "http/client"
url = "{{baseUrl}}/api/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\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}}/api/search"),
Content = new StringContent("{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\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}}/api/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/search"
payload := strings.NewReader("{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\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/api/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 56
{
"query": "",
"filters": {},
"includeTypes": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\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 \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api/search")
.header("content-type", "application/json")
.body("{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}")
.asString();
const data = JSON.stringify({
query: '',
filters: {},
includeTypes: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api/search',
headers: {'content-type': 'application/json'},
data: {query: '', filters: {}, includeTypes: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"query":"","filters":{},"includeTypes":[]}'
};
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}}/api/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "query": "",\n "filters": {},\n "includeTypes": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api/search")
.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/api/search',
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({query: '', filters: {}, includeTypes: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api/search',
headers: {'content-type': 'application/json'},
body: {query: '', filters: {}, includeTypes: []},
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}}/api/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
query: '',
filters: {},
includeTypes: []
});
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}}/api/search',
headers: {'content-type': 'application/json'},
data: {query: '', filters: {}, includeTypes: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"query":"","filters":{},"includeTypes":[]}'
};
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 = @{ @"query": @"",
@"filters": @{ },
@"includeTypes": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api/search"]
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}}/api/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/search",
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([
'query' => '',
'filters' => [
],
'includeTypes' => [
]
]),
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}}/api/search', [
'body' => '{
"query": "",
"filters": {},
"includeTypes": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'query' => '',
'filters' => [
],
'includeTypes' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'query' => '',
'filters' => [
],
'includeTypes' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/api/search');
$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}}/api/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": "",
"filters": {},
"includeTypes": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": "",
"filters": {},
"includeTypes": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/api/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/search"
payload = {
"query": "",
"filters": {},
"includeTypes": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/search"
payload <- "{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\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}}/api/search")
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 \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\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/api/search') do |req|
req.body = "{\n \"query\": \"\",\n \"filters\": {},\n \"includeTypes\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/search";
let payload = json!({
"query": "",
"filters": json!({}),
"includeTypes": ()
});
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}}/api/search \
--header 'content-type: application/json' \
--data '{
"query": "",
"filters": {},
"includeTypes": []
}'
echo '{
"query": "",
"filters": {},
"includeTypes": []
}' | \
http POST {{baseUrl}}/api/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "query": "",\n "filters": {},\n "includeTypes": []\n}' \
--output-document \
- {{baseUrl}}/api/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"query": "",
"filters": [],
"includeTypes": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
nullableOptional_getUser
{{baseUrl}}/api/users/:userId
QUERY PARAMS
userId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users/:userId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api/users/:userId")
require "http/client"
url = "{{baseUrl}}/api/users/:userId"
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}}/api/users/:userId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api/users/:userId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users/:userId"
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/api/users/:userId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api/users/:userId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users/:userId"))
.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}}/api/users/:userId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api/users/:userId")
.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}}/api/users/:userId');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api/users/:userId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users/:userId';
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}}/api/users/:userId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api/users/:userId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/users/:userId',
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}}/api/users/:userId'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api/users/:userId');
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}}/api/users/:userId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users/:userId';
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}}/api/users/:userId"]
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}}/api/users/:userId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users/:userId",
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}}/api/users/:userId');
echo $response->getBody();
setUrl('{{baseUrl}}/api/users/:userId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api/users/:userId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/users/:userId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users/:userId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api/users/:userId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users/:userId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users/:userId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/users/:userId")
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/api/users/:userId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/users/:userId";
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}}/api/users/:userId
http GET {{baseUrl}}/api/users/:userId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api/users/:userId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users/:userId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
nullableOptional_listUsers
{{baseUrl}}/api/users
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api/users")
require "http/client"
url = "{{baseUrl}}/api/users"
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}}/api/users"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api/users");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users"
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/api/users HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api/users")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users"))
.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}}/api/users")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api/users")
.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}}/api/users');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users';
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}}/api/users',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api/users")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/users',
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}}/api/users'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api/users');
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}}/api/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users';
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}}/api/users"]
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}}/api/users" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users",
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}}/api/users');
echo $response->getBody();
setUrl('{{baseUrl}}/api/users');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api/users');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/users' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api/users")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/users")
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/api/users') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/users";
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}}/api/users
http GET {{baseUrl}}/api/users
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api/users
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
nullableOptional_searchUsers
{{baseUrl}}/api/users/search
QUERY PARAMS
query
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users/search?query=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api/users/search" {:query-params {:query ""}})
require "http/client"
url = "{{baseUrl}}/api/users/search?query="
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}}/api/users/search?query="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api/users/search?query=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users/search?query="
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/api/users/search?query= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api/users/search?query=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users/search?query="))
.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}}/api/users/search?query=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api/users/search?query=")
.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}}/api/users/search?query=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api/users/search',
params: {query: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users/search?query=';
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}}/api/users/search?query=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api/users/search?query=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/users/search?query=',
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}}/api/users/search',
qs: {query: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api/users/search');
req.query({
query: ''
});
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}}/api/users/search',
params: {query: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users/search?query=';
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}}/api/users/search?query="]
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}}/api/users/search?query=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users/search?query=",
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}}/api/users/search?query=');
echo $response->getBody();
setUrl('{{baseUrl}}/api/users/search');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'query' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api/users/search');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'query' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/users/search?query=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users/search?query=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api/users/search?query=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users/search"
querystring = {"query":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users/search"
queryString <- list(query = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/users/search?query=")
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/api/users/search') do |req|
req.params['query'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/users/search";
let querystring = [
("query", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/api/users/search?query='
http GET '{{baseUrl}}/api/users/search?query='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/api/users/search?query='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users/search?query=")! 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
nullableOptional_testDeserialization
{{baseUrl}}/api/test/deserialization
BODY json
{
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/test/deserialization");
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 \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api/test/deserialization" {:content-type :json
:form-params {:requiredString ""
:nullableString ""
:optionalString ""
:optionalNullableString ""
:nullableEnum ""
:optionalEnum ""
:nullableUnion ""
:optionalUnion ""
:nullableList []
:nullableMap {}
:nullableObject {:street ""
:city ""
:state ""
:zipCode ""
:country ""
:buildingId ""
:tenantId ""}
:optionalObject {:id ""
:name ""
:domain ""
:employeeCount 0}}})
require "http/client"
url = "{{baseUrl}}/api/test/deserialization"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\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}}/api/test/deserialization"),
Content = new StringContent("{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\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}}/api/test/deserialization");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/test/deserialization"
payload := strings.NewReader("{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\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/api/test/deserialization HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 494
{
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api/test/deserialization")
.setHeader("content-type", "application/json")
.setBody("{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/test/deserialization"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\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 \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api/test/deserialization")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api/test/deserialization")
.header("content-type", "application/json")
.body("{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}")
.asString();
const data = JSON.stringify({
requiredString: '',
nullableString: '',
optionalString: '',
optionalNullableString: '',
nullableEnum: '',
optionalEnum: '',
nullableUnion: '',
optionalUnion: '',
nullableList: [],
nullableMap: {},
nullableObject: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
},
optionalObject: {
id: '',
name: '',
domain: '',
employeeCount: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api/test/deserialization');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api/test/deserialization',
headers: {'content-type': 'application/json'},
data: {
requiredString: '',
nullableString: '',
optionalString: '',
optionalNullableString: '',
nullableEnum: '',
optionalEnum: '',
nullableUnion: '',
optionalUnion: '',
nullableList: [],
nullableMap: {},
nullableObject: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
},
optionalObject: {id: '', name: '', domain: '', employeeCount: 0}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/test/deserialization';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"requiredString":"","nullableString":"","optionalString":"","optionalNullableString":"","nullableEnum":"","optionalEnum":"","nullableUnion":"","optionalUnion":"","nullableList":[],"nullableMap":{},"nullableObject":{"street":"","city":"","state":"","zipCode":"","country":"","buildingId":"","tenantId":""},"optionalObject":{"id":"","name":"","domain":"","employeeCount":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api/test/deserialization',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "requiredString": "",\n "nullableString": "",\n "optionalString": "",\n "optionalNullableString": "",\n "nullableEnum": "",\n "optionalEnum": "",\n "nullableUnion": "",\n "optionalUnion": "",\n "nullableList": [],\n "nullableMap": {},\n "nullableObject": {\n "street": "",\n "city": "",\n "state": "",\n "zipCode": "",\n "country": "",\n "buildingId": "",\n "tenantId": ""\n },\n "optionalObject": {\n "id": "",\n "name": "",\n "domain": "",\n "employeeCount": 0\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 \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api/test/deserialization")
.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/api/test/deserialization',
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({
requiredString: '',
nullableString: '',
optionalString: '',
optionalNullableString: '',
nullableEnum: '',
optionalEnum: '',
nullableUnion: '',
optionalUnion: '',
nullableList: [],
nullableMap: {},
nullableObject: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
},
optionalObject: {id: '', name: '', domain: '', employeeCount: 0}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api/test/deserialization',
headers: {'content-type': 'application/json'},
body: {
requiredString: '',
nullableString: '',
optionalString: '',
optionalNullableString: '',
nullableEnum: '',
optionalEnum: '',
nullableUnion: '',
optionalUnion: '',
nullableList: [],
nullableMap: {},
nullableObject: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
},
optionalObject: {id: '', name: '', domain: '', employeeCount: 0}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api/test/deserialization');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
requiredString: '',
nullableString: '',
optionalString: '',
optionalNullableString: '',
nullableEnum: '',
optionalEnum: '',
nullableUnion: '',
optionalUnion: '',
nullableList: [],
nullableMap: {},
nullableObject: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
},
optionalObject: {
id: '',
name: '',
domain: '',
employeeCount: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api/test/deserialization',
headers: {'content-type': 'application/json'},
data: {
requiredString: '',
nullableString: '',
optionalString: '',
optionalNullableString: '',
nullableEnum: '',
optionalEnum: '',
nullableUnion: '',
optionalUnion: '',
nullableList: [],
nullableMap: {},
nullableObject: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
},
optionalObject: {id: '', name: '', domain: '', employeeCount: 0}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/test/deserialization';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"requiredString":"","nullableString":"","optionalString":"","optionalNullableString":"","nullableEnum":"","optionalEnum":"","nullableUnion":"","optionalUnion":"","nullableList":[],"nullableMap":{},"nullableObject":{"street":"","city":"","state":"","zipCode":"","country":"","buildingId":"","tenantId":""},"optionalObject":{"id":"","name":"","domain":"","employeeCount":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"requiredString": @"",
@"nullableString": @"",
@"optionalString": @"",
@"optionalNullableString": @"",
@"nullableEnum": @"",
@"optionalEnum": @"",
@"nullableUnion": @"",
@"optionalUnion": @"",
@"nullableList": @[ ],
@"nullableMap": @{ },
@"nullableObject": @{ @"street": @"", @"city": @"", @"state": @"", @"zipCode": @"", @"country": @"", @"buildingId": @"", @"tenantId": @"" },
@"optionalObject": @{ @"id": @"", @"name": @"", @"domain": @"", @"employeeCount": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api/test/deserialization"]
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}}/api/test/deserialization" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/test/deserialization",
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([
'requiredString' => '',
'nullableString' => '',
'optionalString' => '',
'optionalNullableString' => '',
'nullableEnum' => '',
'optionalEnum' => '',
'nullableUnion' => '',
'optionalUnion' => '',
'nullableList' => [
],
'nullableMap' => [
],
'nullableObject' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
],
'optionalObject' => [
'id' => '',
'name' => '',
'domain' => '',
'employeeCount' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api/test/deserialization', [
'body' => '{
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api/test/deserialization');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'requiredString' => '',
'nullableString' => '',
'optionalString' => '',
'optionalNullableString' => '',
'nullableEnum' => '',
'optionalEnum' => '',
'nullableUnion' => '',
'optionalUnion' => '',
'nullableList' => [
],
'nullableMap' => [
],
'nullableObject' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
],
'optionalObject' => [
'id' => '',
'name' => '',
'domain' => '',
'employeeCount' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'requiredString' => '',
'nullableString' => '',
'optionalString' => '',
'optionalNullableString' => '',
'nullableEnum' => '',
'optionalEnum' => '',
'nullableUnion' => '',
'optionalUnion' => '',
'nullableList' => [
],
'nullableMap' => [
],
'nullableObject' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
],
'optionalObject' => [
'id' => '',
'name' => '',
'domain' => '',
'employeeCount' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/api/test/deserialization');
$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}}/api/test/deserialization' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/test/deserialization' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/api/test/deserialization", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/test/deserialization"
payload = {
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/test/deserialization"
payload <- "{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\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}}/api/test/deserialization")
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 \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\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/api/test/deserialization') do |req|
req.body = "{\n \"requiredString\": \"\",\n \"nullableString\": \"\",\n \"optionalString\": \"\",\n \"optionalNullableString\": \"\",\n \"nullableEnum\": \"\",\n \"optionalEnum\": \"\",\n \"nullableUnion\": \"\",\n \"optionalUnion\": \"\",\n \"nullableList\": [],\n \"nullableMap\": {},\n \"nullableObject\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n },\n \"optionalObject\": {\n \"id\": \"\",\n \"name\": \"\",\n \"domain\": \"\",\n \"employeeCount\": 0\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/test/deserialization";
let payload = json!({
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": (),
"nullableMap": json!({}),
"nullableObject": json!({
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}),
"optionalObject": json!({
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api/test/deserialization \
--header 'content-type: application/json' \
--data '{
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}'
echo '{
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": {},
"nullableObject": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
},
"optionalObject": {
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
}
}' | \
http POST {{baseUrl}}/api/test/deserialization \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "requiredString": "",\n "nullableString": "",\n "optionalString": "",\n "optionalNullableString": "",\n "nullableEnum": "",\n "optionalEnum": "",\n "nullableUnion": "",\n "optionalUnion": "",\n "nullableList": [],\n "nullableMap": {},\n "nullableObject": {\n "street": "",\n "city": "",\n "state": "",\n "zipCode": "",\n "country": "",\n "buildingId": "",\n "tenantId": ""\n },\n "optionalObject": {\n "id": "",\n "name": "",\n "domain": "",\n "employeeCount": 0\n }\n}' \
--output-document \
- {{baseUrl}}/api/test/deserialization
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"requiredString": "",
"nullableString": "",
"optionalString": "",
"optionalNullableString": "",
"nullableEnum": "",
"optionalEnum": "",
"nullableUnion": "",
"optionalUnion": "",
"nullableList": [],
"nullableMap": [],
"nullableObject": [
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
],
"optionalObject": [
"id": "",
"name": "",
"domain": "",
"employeeCount": 0
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/test/deserialization")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
nullableOptional_updateComplexProfile
{{baseUrl}}/api/profiles/complex/:profileId
QUERY PARAMS
profileId
BODY json
{
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/profiles/complex/:profileId");
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 \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/api/profiles/complex/:profileId" {:content-type :json
:form-params {:nullableRole ""
:nullableStatus ""
:nullableNotification ""
:nullableSearchResult ""
:nullableArray []}})
require "http/client"
url = "{{baseUrl}}/api/profiles/complex/:profileId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/api/profiles/complex/:profileId"),
Content = new StringContent("{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\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}}/api/profiles/complex/:profileId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/profiles/complex/:profileId"
payload := strings.NewReader("{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/api/profiles/complex/:profileId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 131
{
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/api/profiles/complex/:profileId")
.setHeader("content-type", "application/json")
.setBody("{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/profiles/complex/:profileId"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\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 \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api/profiles/complex/:profileId")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/api/profiles/complex/:profileId")
.header("content-type", "application/json")
.body("{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}")
.asString();
const data = JSON.stringify({
nullableRole: '',
nullableStatus: '',
nullableNotification: '',
nullableSearchResult: '',
nullableArray: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/api/profiles/complex/:profileId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/api/profiles/complex/:profileId',
headers: {'content-type': 'application/json'},
data: {
nullableRole: '',
nullableStatus: '',
nullableNotification: '',
nullableSearchResult: '',
nullableArray: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/profiles/complex/:profileId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"nullableRole":"","nullableStatus":"","nullableNotification":"","nullableSearchResult":"","nullableArray":[]}'
};
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}}/api/profiles/complex/:profileId',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "nullableRole": "",\n "nullableStatus": "",\n "nullableNotification": "",\n "nullableSearchResult": "",\n "nullableArray": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api/profiles/complex/:profileId")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/profiles/complex/:profileId',
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({
nullableRole: '',
nullableStatus: '',
nullableNotification: '',
nullableSearchResult: '',
nullableArray: []
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/api/profiles/complex/:profileId',
headers: {'content-type': 'application/json'},
body: {
nullableRole: '',
nullableStatus: '',
nullableNotification: '',
nullableSearchResult: '',
nullableArray: []
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/api/profiles/complex/:profileId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
nullableRole: '',
nullableStatus: '',
nullableNotification: '',
nullableSearchResult: '',
nullableArray: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/api/profiles/complex/:profileId',
headers: {'content-type': 'application/json'},
data: {
nullableRole: '',
nullableStatus: '',
nullableNotification: '',
nullableSearchResult: '',
nullableArray: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/profiles/complex/:profileId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"nullableRole":"","nullableStatus":"","nullableNotification":"","nullableSearchResult":"","nullableArray":[]}'
};
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 = @{ @"nullableRole": @"",
@"nullableStatus": @"",
@"nullableNotification": @"",
@"nullableSearchResult": @"",
@"nullableArray": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api/profiles/complex/:profileId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api/profiles/complex/:profileId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/profiles/complex/:profileId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'nullableRole' => '',
'nullableStatus' => '',
'nullableNotification' => '',
'nullableSearchResult' => '',
'nullableArray' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/api/profiles/complex/:profileId', [
'body' => '{
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api/profiles/complex/:profileId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'nullableRole' => '',
'nullableStatus' => '',
'nullableNotification' => '',
'nullableSearchResult' => '',
'nullableArray' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'nullableRole' => '',
'nullableStatus' => '',
'nullableNotification' => '',
'nullableSearchResult' => '',
'nullableArray' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/api/profiles/complex/:profileId');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/profiles/complex/:profileId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/profiles/complex/:profileId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/api/profiles/complex/:profileId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/profiles/complex/:profileId"
payload = {
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/profiles/complex/:profileId"
payload <- "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/profiles/complex/:profileId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/api/profiles/complex/:profileId') do |req|
req.body = "{\n \"nullableRole\": \"\",\n \"nullableStatus\": \"\",\n \"nullableNotification\": \"\",\n \"nullableSearchResult\": \"\",\n \"nullableArray\": []\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}}/api/profiles/complex/:profileId";
let payload = json!({
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/api/profiles/complex/:profileId \
--header 'content-type: application/json' \
--data '{
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}'
echo '{
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
}' | \
http PATCH {{baseUrl}}/api/profiles/complex/:profileId \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "nullableRole": "",\n "nullableStatus": "",\n "nullableNotification": "",\n "nullableSearchResult": "",\n "nullableArray": []\n}' \
--output-document \
- {{baseUrl}}/api/profiles/complex/:profileId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"nullableRole": "",
"nullableStatus": "",
"nullableNotification": "",
"nullableSearchResult": "",
"nullableArray": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/profiles/complex/:profileId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
nullableOptional_updateTags
{{baseUrl}}/api/users/:userId/tags
QUERY PARAMS
userId
BODY json
{
"tags": [],
"categories": [],
"labels": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users/:userId/tags");
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 \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/api/users/:userId/tags" {:content-type :json
:form-params {:tags []
:categories []
:labels []}})
require "http/client"
url = "{{baseUrl}}/api/users/:userId/tags"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\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}}/api/users/:userId/tags"),
Content = new StringContent("{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\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}}/api/users/:userId/tags");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users/:userId/tags"
payload := strings.NewReader("{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\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/api/users/:userId/tags HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 52
{
"tags": [],
"categories": [],
"labels": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/api/users/:userId/tags")
.setHeader("content-type", "application/json")
.setBody("{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users/:userId/tags"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\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 \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api/users/:userId/tags")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/api/users/:userId/tags")
.header("content-type", "application/json")
.body("{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}")
.asString();
const data = JSON.stringify({
tags: [],
categories: [],
labels: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/api/users/:userId/tags');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/api/users/:userId/tags',
headers: {'content-type': 'application/json'},
data: {tags: [], categories: [], labels: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users/:userId/tags';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"tags":[],"categories":[],"labels":[]}'
};
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}}/api/users/:userId/tags',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "tags": [],\n "categories": [],\n "labels": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api/users/:userId/tags")
.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/api/users/:userId/tags',
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({tags: [], categories: [], labels: []}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/api/users/:userId/tags',
headers: {'content-type': 'application/json'},
body: {tags: [], categories: [], labels: []},
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}}/api/users/:userId/tags');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
tags: [],
categories: [],
labels: []
});
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}}/api/users/:userId/tags',
headers: {'content-type': 'application/json'},
data: {tags: [], categories: [], labels: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users/:userId/tags';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"tags":[],"categories":[],"labels":[]}'
};
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 = @{ @"tags": @[ ],
@"categories": @[ ],
@"labels": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api/users/:userId/tags"]
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}}/api/users/:userId/tags" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users/:userId/tags",
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([
'tags' => [
],
'categories' => [
],
'labels' => [
]
]),
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}}/api/users/:userId/tags', [
'body' => '{
"tags": [],
"categories": [],
"labels": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api/users/:userId/tags');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'tags' => [
],
'categories' => [
],
'labels' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'tags' => [
],
'categories' => [
],
'labels' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/api/users/:userId/tags');
$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}}/api/users/:userId/tags' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"tags": [],
"categories": [],
"labels": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users/:userId/tags' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"tags": [],
"categories": [],
"labels": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/api/users/:userId/tags", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users/:userId/tags"
payload = {
"tags": [],
"categories": [],
"labels": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users/:userId/tags"
payload <- "{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\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}}/api/users/:userId/tags")
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 \"tags\": [],\n \"categories\": [],\n \"labels\": []\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/api/users/:userId/tags') do |req|
req.body = "{\n \"tags\": [],\n \"categories\": [],\n \"labels\": []\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}}/api/users/:userId/tags";
let payload = json!({
"tags": (),
"categories": (),
"labels": ()
});
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}}/api/users/:userId/tags \
--header 'content-type: application/json' \
--data '{
"tags": [],
"categories": [],
"labels": []
}'
echo '{
"tags": [],
"categories": [],
"labels": []
}' | \
http PUT {{baseUrl}}/api/users/:userId/tags \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "tags": [],\n "categories": [],\n "labels": []\n}' \
--output-document \
- {{baseUrl}}/api/users/:userId/tags
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"tags": [],
"categories": [],
"labels": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users/:userId/tags")! 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()
PATCH
nullableOptional_updateUser
{{baseUrl}}/api/users/:userId
QUERY PARAMS
userId
BODY json
{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api/users/:userId");
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 \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/api/users/:userId" {:content-type :json
:form-params {:username ""
:email ""
:phone ""
:address {:street ""
:city ""
:state ""
:zipCode ""
:country ""
:buildingId ""
:tenantId ""}}})
require "http/client"
url = "{{baseUrl}}/api/users/:userId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/api/users/:userId"),
Content = new StringContent("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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}}/api/users/:userId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api/users/:userId"
payload := strings.NewReader("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/api/users/:userId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 200
{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/api/users/:userId")
.setHeader("content-type", "application/json")
.setBody("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api/users/:userId"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\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 \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api/users/:userId")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/api/users/:userId")
.header("content-type", "application/json")
.body("{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/api/users/:userId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/api/users/:userId',
headers: {'content-type': 'application/json'},
data: {
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api/users/:userId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"username":"","email":"","phone":"","address":{"street":"","city":"","state":"","zipCode":"","country":"","buildingId":"","tenantId":""}}'
};
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}}/api/users/:userId',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "username": "",\n "email": "",\n "phone": "",\n "address": {\n "street": "",\n "city": "",\n "state": "",\n "zipCode": "",\n "country": "",\n "buildingId": "",\n "tenantId": ""\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 \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api/users/:userId")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/api/users/:userId',
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({
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/api/users/:userId',
headers: {'content-type': 'application/json'},
body: {
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/api/users/:userId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/api/users/:userId',
headers: {'content-type': 'application/json'},
data: {
username: '',
email: '',
phone: '',
address: {
street: '',
city: '',
state: '',
zipCode: '',
country: '',
buildingId: '',
tenantId: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api/users/:userId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"username":"","email":"","phone":"","address":{"street":"","city":"","state":"","zipCode":"","country":"","buildingId":"","tenantId":""}}'
};
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 = @{ @"username": @"",
@"email": @"",
@"phone": @"",
@"address": @{ @"street": @"", @"city": @"", @"state": @"", @"zipCode": @"", @"country": @"", @"buildingId": @"", @"tenantId": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api/users/:userId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api/users/:userId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api/users/:userId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'username' => '',
'email' => '',
'phone' => '',
'address' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/api/users/:userId', [
'body' => '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api/users/:userId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'username' => '',
'email' => '',
'phone' => '',
'address' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'username' => '',
'email' => '',
'phone' => '',
'address' => [
'street' => '',
'city' => '',
'state' => '',
'zipCode' => '',
'country' => '',
'buildingId' => '',
'tenantId' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/api/users/:userId');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api/users/:userId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api/users/:userId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/api/users/:userId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api/users/:userId"
payload = {
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api/users/:userId"
payload <- "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api/users/:userId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/api/users/:userId') do |req|
req.body = "{\n \"username\": \"\",\n \"email\": \"\",\n \"phone\": \"\",\n \"address\": {\n \"street\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zipCode\": \"\",\n \"country\": \"\",\n \"buildingId\": \"\",\n \"tenantId\": \"\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api/users/:userId";
let payload = json!({
"username": "",
"email": "",
"phone": "",
"address": json!({
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/api/users/:userId \
--header 'content-type: application/json' \
--data '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}'
echo '{
"username": "",
"email": "",
"phone": "",
"address": {
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
}
}' | \
http PATCH {{baseUrl}}/api/users/:userId \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "username": "",\n "email": "",\n "phone": "",\n "address": {\n "street": "",\n "city": "",\n "state": "",\n "zipCode": "",\n "country": "",\n "buildingId": "",\n "tenantId": ""\n }\n}' \
--output-document \
- {{baseUrl}}/api/users/:userId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"username": "",
"email": "",
"phone": "",
"address": [
"street": "",
"city": "",
"state": "",
"zipCode": "",
"country": "",
"buildingId": "",
"tenantId": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api/users/:userId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()